tablesorter is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell. ### [Documentation](http://mottie.github.io/tablesorter/docs/) * See the [full documentation](http://mottie.github.io/tablesorter/docs/). * All of the [original document pages](http://tablesorter.com/docs/) have been included. * Information from my blog post on [undocumented options](http://wowmotty.blogspot.com/2011/06/jquery-tablesorter-missing-docs.html) and lots of new demos have also been included. * Change log moved from included text file into the [wiki documentation](https://github.com/Mottie/tablesorter/wiki/Change). ### Demos * [Basic alpha-numeric sort Demo](http://mottie.github.com/tablesorter/). * Links to demo pages can be found within the main [documentation](http://mottie.github.io/tablesorter/docs/). * More demos & playgrounds - updated in the [wiki pages](https://github.com/Mottie/tablesorter/wiki). ### Features * Multi-column alphanumeric sorting. * Multi-tbody sorting - see the [options](http://mottie.github.io/tablesorter/docs/index.html#options) table on the main document page. * Parsers for sorting text, alphanumeric text, URIs, integers, currency, floats, IP addresses, dates (ISO, long and short formats) & time. [Add your own easily](http://mottie.github.io/tablesorter/docs/example-parsers.html). * Support for ROWSPAN and COLSPAN on TH elements. * Support secondary "hidden" sorting (e.g., maintain alphabetical sort when sorting on other criteria). * Extensibility via [widget system](http://mottie.github.io/tablesorter/docs/example-widgets.html). * Cross-browser: IE 6.0+, FF 2+, Safari 2.0+, Opera 9.0+. * Small code size. * Works with jQuery 1.2.6+ (jQuery 1.4.1+ needed with some widgets). * Works with jQuery 1.9+ ($.browser.msie was removed; needed in the original version). ### Licensing * Copyright (c) 2007 Christian Bach. * Original examples and docs at: [http://tablesorter.com](http://tablesorter.com). * Dual licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) and [GPL](http://www.gnu.org/licenses/gpl.html) licenses. ### Special Thanks * Big shout-out to [Nick Craver](https://github.com/NickCraver) for getting rid of the `eval()` function that was previously needed for multi-column sorting. * Big thanks to [thezoggy](https://github.com/thezoggy) for helping with code, themes and providing valuable feedback. * Big thanks to [ThsSin-](https://github.com/TheSin-) for taking over for a while and also providing valuable feedback. * And, of course thanks to everyone else that has contributed, and continues to contribute to this forked project! ### Change Log View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change). #### Version 2.13.3 (11/9/2013) * Pager (plugin/widget) * Fixed initial filter settings when using pager ajax. Fixes [issue #388](https://github.com/Mottie/tablesorter/issues/388). * Fixed ajax pager not recognizing column sorting. Fixes [issue #408](https://github.com/Mottie/tablesorter/issues/408). * The core plugin now remove rows from table when using pager ajax. Fixes [issue #411](https://github.com/Mottie/tablesorter/issues/411). * Filter widget * Renamed all variables & restructured the entire widget. * Added better integration with the pager plugin/widget to minimize ajax server calls by getting default filter settings. Fixes [issue #388](https://github.com/Mottie/tablesorter/issues/388). * Fixed filter formatter HTML5 spinner to properly find exact matches. * Added a new fuzzy search parameter * Fuzzy searches match sequential characters, similar to how Sublime Text searches work * Start the search with a tilde `~` followed by any sequential characters to match. * Examples: `~bee` will match both "Bruce Lee" and "Brenda Lee", `~bcd` will find "Brandon Clark" and `~piano` will find "Philip Aaron Wong" * Added `filter_anyMatch` * Set this option to `true` when using an external search filter. * Setting this option should work properly with or without the column filters. The only issue you would have is if you triggered a search on the table using an array with undefined or null array values. * Some limitations are applied when using any match. Search operators, range queries and not-matches are not allowed. * See [the demo](http://mottie.github.io/tablesorter/docs/example-widget-filter-any-match.html) for examples & more details. * Thanks to [@prainho](https://github.com/prainho) for the suggestion, code and feedback in [issue #405](https://github.com/Mottie/tablesorter/issues/405)! * Modified the `bindSearch` function to allow using it on external filters: * Use as follows: `$.tablesorter.filter.bindSearch( $('table'), $('.search') );` * Binding the search input using this method allows the search to use `filter_liveSearch`, delayed searching and pressing escape to clear the search. * See the [filter any match demo](http://mottie.github.io/tablesorter/docs/example-widget-filter-any-match.html) for example usage. * UITheme widget * Added caption styling * Updated css for jQuery UI theme and Bootstrap theme. * Theme, demo & doc updates * Added jQuery UI theme switcher to [jQuery UI theme demo](http://mottie.github.io/tablesorter/docs/example-widget-ui-theme.html) & [jQuery UI filter formatter demo](http://mottie.github.io/tablesorter/docs/example-widget-filter-formatter-1.html). * Added ignore articles parser to [saveSort widget demo](http://mottie.github.io/tablesorter/docs/example-widget-savesort.html). * Updated history of changes made to `cssAsc`, `cssDesc` & `cssHeader` on the main documentation page. See [issue #407](https://github.com/Mottie/tablesorter/issues/407). #### Version 2.13.2 (11/2/2013) * Updated pager & filter widget to work when the pager `countChildRows` option is `true`: * Filter widget now properly added a "filtered" class to child rows * Pager plugin & widget now properly calculate a correct total number of rows * See [issue #396](https://github.com/Mottie/tablesorter/issues/396). * Updated editable widget to target table cell children if they exist * This fixes the issue in IE where making a table element contenteditable is not allowed. * See [issue #404](https://github.com/Mottie/tablesorter/issues/404) for further details. #### Version 2.13.1 (10/31/2013) * Fixed filter widget issues * filter indexing will now be correct, even if a "tablesorter-filter" input/select doesn't exist in the filter row * Already parsed filters (filter-formatter) will not attempt to reparse the value; problem was caused by parsed dates. #### Version 2.13 (10/30/2013) * Added a "Development" branch to the repository. * I have started development on version 3 of tablesorter and this branch will have a basic structure to allow modularization of tablesorter. * So far, only the tablesorter core has been restructured and reorganized. * Added basic Zepto support to the core and some basic widgets, this is a work-in-progress. See [issue #398](https://github.com/Mottie/tablesorter/issues/398). * Ensure resized headers have stored data, or provide a fallback. Fixes [issue #394](https://github.com/Mottie/tablesorter/issues/394). * Added pager `countChildRows` option (plugin & widget) * When `true`, the pager treats child rows as if it were a parent row and strictly enforces showing only the set number of pager rows. * This can cause problems as a child row may not appear associated with its parent, may be split across pages or possibly distort the table layout if the parent or child row contain row or cell spans. * When `false` the pager always includes the child row with its parent, ignoring the set pager size. * See [issue #396](https://github.com/Mottie/tablesorter/issues/396). * Removed triggered change event to fix [issue #400](https://github.com/Mottie/tablesorter/issues/400). * Merged in filter formatter fix for jQuery UI dateFormat conflict; [pull #403](https://github.com/Mottie/tablesorter/pull/403). Thanks @Craga89! * Grouping widget update * Added `group_separator` option which is used when a `group-separator-#` class name is applied * Updated [grouping widget demo](http://mottie.github.io/tablesorter/docs/example-widget-grouping.html). * Added a file-type parser * Optimally used with the grouping widget to sort similar file types (e.g. video extensions: .mp4, .avi, .mov, etc) * [File type sorting demo](http://mottie.github.io/tablesorter/docs/example-parsers-file-type.html) added. * Updated LESS theme to work properly with LESS 4.1+ * Other changes * Improved `formatFloat()` replace method. * Sorting a zero hex value (`0x00`) is now possible. #### Version 2.12 (10/18/2013) **Core** * Added `numberSorter` option allowing you to modify the overall numeric sorter. * Updated the `textSorter` option to allow setting a text sorter for each column. * The `textSorter` functon parameters have changed from `(a, b, table, column)` to `(a, b, direction, column, table)`. * Restructured & combined sorting functions internally so that tablesorter will always sort empty cells no matter what sorting algorithm is used by the `textSorter`. * Renamed `$.tablesorter.sortText()` to `$.tablesorter.sortNatural()` * Added a new basic alphabetical sort algorithm `$.tablesorter.sortText = function(a, b) { return a > b ? 1 : (a < b ? -1 : 0); };` which can be set using the `textSorter` option. * New examples can be found in the updated [custom sort demo](http://mottie.github.io/tablesorter/docs/example-option-custom-sort.html). * Added `fixedUrl` option for use with the `$.tablesorter.storage()` function. * Setting this with a fixed name (it doesn't need to be a url) allows saving table data (`saveSort` widget, `savePages` in pager widget) for tables on multiple pages in a domain. * Additional storage options are described below under "Storage". * An accurate number of table columns is now contained within `table.config.columns`. This accounts for multiple header rows, tds, ths, etc. * Replaced `.innerHTML` with jQuery's `.html()` to fix issues in IE8. Fixes [issue #385](https://github.com/Mottie/tablesorter/issues/385). * Version numbers should now all be accurate, even in the comments.. at least this time ;). Fixes [issue #386](https://github.com/Mottie/tablesorter/issues/386). **Pager** * In attempts to initialize the pager after the filter widget: * Added a pager widget (still beta testing) to allow initializing the pager after certain widgets (filter widget). * Updated tablesorter core (properly count table columns) & filter widget code to allow it to initialize on an empty table (thanks @stanislavprokopov!). * Hopefully one or both of these changes fixes [issue #388](https://github.com/Mottie/tablesorter/issues/388). * New pager widget demos: [basic](http://mottie.github.io/tablesorter/docs/example-widget-pager.html) & [ajax](http://mottie.github.io/tablesorter/docs/example-widget-pager-ajax.html). * `savePages` option * Should no longer cause an error if stored data is malformed or unrecognized. Fixes [issue #387](https://github.com/Mottie/tablesorter/issues/387). * The stored size and page is now cleared if the table is destroyed. * Fixed an error occuring in IE when trying to determine if a variable is an array (`toString` function call not recognized). Fixes [issue #390](https://github.com/Mottie/tablesorter/issues/390). * Updated pager rendering to prevent multiple ajax calls. * During this update, the pager page size would return as zero and set the totalPages value to inifinity. Yeah, it doesn't do that anymore; but you can still set the pager size to zero if you want! **Widgets** * Filter widget: * Should now properly initialize when the pager plugin/widget is used with ajax and/or the `filter_serversideFiltering` option is `true`. Fixes [issue #388](https://github.com/Mottie/tablesorter/issues/388). * Please note that the select dropdowns still sort using the natural sort algorithm, but since it is using the function directly, empty cells will not sort based on the `emptyTo` option. If this is a big problem, let me know! * Grouping widget: * Added `group_callback` option - this sets a callback function which allows modification of each group header label - like adding a subtotal for each group, or something. See the [updated demo](http://mottie.github.io/tablesorter/docs/example-widget-grouping.html). * Added `group_complete` option which is `"groupingComplete"` by default. This is the name of the event that is triggered once the grouping widget has completed updating. * Updated the editable widget: * Added `editable_editComplete` option which names the event that is triggered after tablesorter has completed updating the recent edit. * You can also bind to the `change` event for that editable element, but it may occur before tablesorter has updated its internal data cache. * Storage * The `$.tablesorter.storage()` function now has options including the `fixedUrl` option described in the core section above. * Also added storage options which can be used for custom widgets: `$.tablesorter.storage(table, key, value, { url : 'mydomain', id : 'table-group' })`. * Additionally, for already build-in widgets, you can apply data-attributes to the table: `