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. * Also big thanks to [thezoggy](https://github.com/thezoggy) for helping with code, themes and providing valuable feedback. * And, 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.10.8 (6/3/2013) * Updated the percent parser to only detect if the content is shorter than 15 characters. This prevents columns with a lot of content and one percent sign (%) from being set to be parsed as a percent numeric column. Fixes [issue #320](https://github.com/Mottie/tablesorter/issues/320). * Updated filter widget & filter_formatter: * Added a new `filter_defaultAttrib` which points to the default `'data-value'` attribute in the table header which will contain the filter's default (starting) value and *will override* any set values within the filter_formatter functions. Updated the [custom filter widget function demo age column](http://mottie.github.io/tablesorter/docs/example-widget-filter-custom.html) to show this in action. * The `$.tablesorter.setFilter()` method now properly updates the filter formatter elements when set. * The `uiDateCompare` and `uiDatepicker` functions now adds a time of 11:59:59 to the "to" date or when a "less than" comparison is made so as to include all times within that selected day. * The `defaultDate` option (not `date` option, sorry) of the `uiDateCompare` now properly sets the value upon initialization. * The `from` and `to` options of the `uiDatepicker` now properly sets those values properly upon initialization. * Fixes [issue #321](https://github.com/Mottie/tablesorter/issues/321). * Fixed stickyHeaders widget: * When removing a sticky headers widget, it no longer unbinds scrolling when other sticky headers are still active. * Added `stickyHeaders_includeCaption` option (set as `true` by default). When this option is `false` and a caption exists, it will not be included in teh sticky header. Fixes [issue #322](https://github.com/Mottie/tablesorter/issues/322). #### Version 2.10.7 (5/31/2013) * Now using correct `closest()` function equivalent. Thanks to [isuTony](https://github.com/isuTony); Fixes [issue #319](https://github.com/Mottie/tablesorter/issues/319). * Anticipating my sabbitical, I've added a few "beta-testing" scripts into a new folder for feedback, code fixes and help: * [Custom pager control script](http://mottie.github.io/tablesorter/beta-testing/example-pager-custom-controls.html) - should be working properly. * [External filters using Select2 plugin](http://mottie.github.io/tablesorter/beta-testing/example-external-filters-using-select2.html) - should be working properly. * [Column reorder widget](http://mottie.github.io/tablesorter/beta-testing/example-widget-column-reorder.html) - not working 100% with sticky headers. * [Column sum widget](http://mottie.github.io/tablesorter/beta-testing/example-widget-sum-columns.html) - still needs LOTS of work! #### Version 2.10.6 (5/30/2013) * Added `skipTest` options to the HTML5 filter formatter functions. Fixes [issue #307](https://github.com/Mottie/tablesorter/issues/307). #### Version 2.10.5 (5/30/2013) * Filter formatter functions now works properly within sticky headers. Fixes issues [#290](https://github.com/Mottie/tablesorter/issues/290) & [#317](https://github.com/Mottie/tablesorter/issues/317). #### Version 2.10.4 (5/28/2013) * Added `stickyHeadersInit` event, which is triggered on the table after the sticky headers widget has completed initializing. * Filtering child rows should now work properly; [fixes #306](https://github.com/Mottie/tablesorter/issues/306). #### Version 2.10.3 (5/27/2013) * Updated pager `pageSize` method to properly store the set page size; [fixes #287](https://github.com/Mottie/tablesorter/issues/287). #### Version 2.10.2 (5/27/2013) * The minified scripts are now updated =/. #### Version 2.10.1 (5/27/2013) * Core fixes * Fixed `updateAll` function to properly refresh the widgets. * Added keyboard accessibility * Header cells can now be accessed using the tab key and sorted by pressing enter when they have "focus". * Thanks to [debugwand](https://github.com/debugwand) for sharing the code! * Filter widget updates: * Added `filter_onlyAvail` option * Updated main & filter demo page docs. * Updated [custom filter demo](http://mottie.github.io/tablesorter/docs/example-widget-filter-custom.html) (see the Discount column). * Fixes [issue #292](https://github.com/Mottie/tablesorter/issues/292). * Thanks to [The Sin-](https://github.com/TheSin-) for sharing the idea and code! * Added `compare` option to various filter formatter functions * This addition was made to the "uiSpinner", "uiSlider", "html5Range", "html5Number" and the new "uiDateCompare" functions * So, for example the html5Number function can be set up as follows: ```js filter_formatter : { 0: function($cell, indx) { return $.tablesorter.filterFormatter.html5Number( $cell, indx, { value: 1, min: 1, max: 100, delay: true, addToggle: false, exactMatch: false, compare: '>=' }) } } ``` now the number type input will allow filtering rows with values greater than or equal to the selected value. * Thanks to [The Sin-](https://github.com/TheSin-) for sharing the idea and code in [issue #304](https://github.com/Mottie/tablesorter/issues/304). * The jQuery UI Datepicker range filter formatter code has been updated: * Use the new `uiDateCompare` filter formatter for one input comparisons, or use this `uiDatepicker` update to do comparisons within the two inputs. * The two input now functions so that when the "to" input is empty, all dates greater than the "from" date are shown. * If the "from" input is empty, all dates less than the "to" input date are shown. * Added options `textFrom` (default is `from`) and `textTo` (default is `to`) to allow changing the text label language. * Modified the logical "or" search such that it tries to find an exact match for each "or". For example: * If `"1|2|3"` is entered into the filter, only column cells that exactly match `1`, `2`, or `3` will be visible. * If `"Mike|Br|John"` is entered, only cells with `Mike`, `Br` and `John` will be visible. If you want to include `Bruce`, then use a wild card: `"Mike|Br*|John"`. * To only match content using the logical "or" search, simply add the class name `filter-match` to the header cell, then `"1|2|3"` will show cells with `1`, `11`, `12`, etc. * Updated the [basic filter widget demo](http://mottie.github.io/tablesorter/docs/example-widget-filter.html) to include a "filter-match" column toggle. * Fixed javascript error from improper reference to the "dateFormat". Fixes [issue #306](https://github.com/Mottie/tablesorter/issues/306). * Fixed `$.tablesorter.getFilters()` and `$.tablesorter.setFilters()` functions to work properly when the `filter_columnFilters` option is `false` (do not build filter row). * Fixed filter widget numeric range error introduces in v2.10.0. Sorry =(. * Fixed filter search delay issue, again. =( * Fixed filter widget data comparisons, so now you can type in the filter something like `> 1/1/2010` (using the same date format as the column). * Filter search input placeholders can now be set using jQuery data: * Previously, only a data attribute could contain the filter placeholder text `data-placeholder="Enter something..."` * Another method using script can now be used: `$('.tablesorter th:eq(0)').data('placeholder', 'Enter something...');` (where `eq()` contains a zero-based index of the column). * Optimized filter queries to search already filtered rows if the previous search is contained within the current search. Fulfills part of [issue #313](https://github.com/Mottie/tablesorter/issues/313). * Added a caution note in the filter widget (basic) demo stating the issue with Chrome not rendering search input text properly when previously hidden. * For now, I set the `filter_hideFilters` option to `false` until the source of this problem is determined. * Check out [this demo](http://jsfiddle.net/Mottie/Mjbab/1/) to see the issue (in Chrome); but I think I'm the only one seeing it. * Updated the `$.tablesorter.storage()` function * The update is to checking for localStorage browser support. * It should now work properly in iOS with private browsing protection. * Check out [this great summary](https://gist.github.com/paulirish/5558557) of [Modernizr](http://modernizr.com/) updates by Paul Irish. * Documentation fixes * Removed `console.log` from the documentation script. Fixes [issue #309](https://github.com/Mottie/tablesorter/issues/309). * Updated all `