13 KiB
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
- See the full documentation.
- All of the original document pages have been included.
- Information from my blog post on undocumented options and lots of new demos have also been included.
- Change log moved from included text file into the wiki documentation.
Demos
- Basic alpha-numeric sort Demo.
- Links to demo pages can be found within the main documentation.
- More demos & playgrounds - updated in the wiki pages.
Features
- Multi-column alphanumeric sorting and filtering.
- Multi-tbody sorting - see the options table on the main document page.
- Supports Bootstrap v2 and 3
- Parsers for sorting text, alphanumeric text, URIs, integers, currency, floats, IP addresses, dates (ISO, long and short formats) & time. Add your own easily.
- Inline editing - see demo
- 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.
- Cross-browser: IE 6.0+, FF 2+, Safari 2.0+, Opera 9.0+, Chrome 5.0+.
- Small code size, starting at 25K minified
- 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.
- Dual licensed under the MIT and GPL licenses.
Special Thanks
- Big shout-out to Nick Craver for getting rid of the
eval()
function that was previously needed for multi-column sorting. - Big thanks to thezoggy for helping with code, themes and providing valuable feedback.
- Big thanks to ThsSin- for taking over for a while and also providing valuable feedback.
- Also extra thanks to christhomas and Lynesth for help with code.
- 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.
Version 2.16.1-beta (4/22/2014)
- Docs:
- Add note about using buttons in forms (include
type="button"
). Fixes issue #543. - Add example link to select2 demo for the
filter_selectSource
entry.
- Add note about using buttons in forms (include
- Filter widget: setFilters now supports passing it a jQuery table object
- Static Row widget
- Add more inline comments
- Fix issue with not repositioning static row properly within mutliple tbodies.
Version 2.16.0-beta (4/20/2014)
-
Doc & testing updates
- More version numbers added - when certain variable & functions were added or last updated.
- Update to use Bootstrap 3.1.1.
- Update to the latest testing files.
- Reorganize example section & cleanup.
- Fix demos that include togglable parsed data.
- Fix miscellaneous typos.
-
Core
- Make
computeColumnIndex
function public (get details). - Move cache rows into the normalized data
- This is a big change, as the cache rows no longer exist and did break several widgets.
- This change allows for the Filter widget to better work with cached data (pager with
removeRows
set totrue
) & makes the sort tbodies widget possible. - Updated core tests.
- Update
textExtraction
option- Default option is now
"basic"
and checks for a data-attribute (set by by the newtextAttribute
option). - Set this option to any string (besides an empty string) to revert back to the original method; this may be necessary in older versions of IE due to initialization speed issues.
- Fixes issue #154
- Default option is now
- Add
textAttribute
option- It contains the data-attribute name which contains alternative table cell text.
- This only applies to tbody table cells.
- Add
sortReset
method callback (e.g.$("table").trigger("sortReset", [callback]);
) - Update
applyWidgets
method to prevent being called numerous consecutive times. - Destroy method now clears the table cache & pager rows copy
- Make
-
Parsers (extract date parsers)
- "extractUSLongDate" - this parser finds a US long date anywhere in a table cell (demo)
- "extractMMDDYYYY" - this parser extracts dates in MMDDYYYY format (demo)
- "extractDDMMYYYY" - this parser extracts dates in DDMMYYYY format (demo)
- "extractYYYYMMDD" - this parser extracts dates in MMDDYYYY format (demo)
-
Filter widget
- Updated to use the new modified internal cache format.
- Now usable with the pager with the
removeRows
option set totrue
. - Fixes issue #515.
- Now usable with the pager with the
- Add
filter_placeholder
global settings. Fixes issue #582. - Add
filter_selectSource
option.- Allows add filter select options from an alternate source (e.g. ajax), or customizing options from the set column contents.
- Fixes issue #328.
- Include
th
's in the tbody. - Fix build select tbody indexing.
- Filter reset (
filter_reset
) now accepts a jQuery object.
- Updated to use the new modified internal cache format.
-
Filter formatter
- Add to & from date placeholders to date range. Fixes issue #582.
- Fix saved Datepicker range values. Fixes issue #512.
- Add select2 filter formatter code. May fix issue #534 - see demo
-
Math widget
- New math widget demo Replaces the previous alpha "Column sum widget" demo.
- This widget adds basic math capabilities; by default the following functions are available: count, sum, max, min, mean, median, mode, range, variance (sample & population), standard deviation (sample & population).
- Custom math functions can be added
- Data from cells is gathered from the row, cells "above" the target cell, column, or the entire table.
- More details are provided on the demo page.
- Fixes issue #136.
-
Output widget
- This widget will output the table data as any of the following data formats:
- Any separator: comma (csv), tabs (tsv), spaces, etc
- Javascript array
- JSON
- Output the entire table, filtered or visible rows.
- Works with the filter & pager widgets.
- See this demo for more details.
- This widget will output the table data as any of the following data formats:
-
Pager
- The
ajaxObject
success function will no longer be called twice on initialization. Fixes issue #540. - Update to work with the filter widget & the modified row cache. Fixes issue #515.
- Destroy method now clears the table cache & pager rows copy.
- Add
pageReset
option - pager resets to set page after filtering the table. Fixes issue #565.
- The
-
Reflow & Reflow2 widget
- These widgets change the layout of the table when a set browser width breakpoint is reached.
- Each tbody cell will display the header cell text when the table reflows.
- See this demo.
- Fixes issue #165.
-
Scroller widget
-
Static Row widget
- Modified from the Tablesorter-Static-Row-Plugin by ascii-soup.
- This widget works with multiple tbodies (but not information only tbodies).
- Dynamically set & update the static row.
- For more details see the demo.
- Fixes issues #120 & #472.
-
StickyHeaders widget - the cloned table (sticky part) tbody & tfoot are now removed instead of hidden.
Version 2.15.14 (4/10/2014)
- Modified
bower.json
to allow "read-components" compatibility. See PR #573 - Corrected docs:
- Filter-external doc error. Fixes issue #571
- Added pager
ajaxProcessing
documentation about extra values available for the output. Fixes issue #576. - Grouping widget demo update (now uses collapsible table for options)
- Core: Destroy method update
-
When including a
false
parameter with the destroy method, class names will be left intact as before. But this now includes the reapplying of the uitheme and zebra widgets.$("table").trigger("destroy", [false]);
-
This change will maintain the table's appearance.
-
See this Stackoverflow question for why this change was made.
-
- Grouping widget: group name now saves after callback. Fixes issue #514.
- Pager
processAjaxOnInit
now works with jQuery objects. Fixes issue #572. - Filter widget:
getFilters
will not cause a js error when it targets a non-tablesorter table.
Version 2.15.13 (4/3/2014)
- Core:
- Fix widgets not being applied after an update.
- Ignore child row class name if it is the first table row
- Filter widget ignores info tbodies again. Fixes issue #568
- Docs: show resizable widget update
- Bootstrap theme:
Version 2.15.12 (3/31/2014)
- Replaced references to
cell.cellIndex
with$(cell).index()
- Prevents an error in IE8
- Thanks sylvain-hamel!
- Fixed merge issues, then modified code to minize use of this indexing
- Cell column property has correct value again.
- Fixes issue #554
- Fix docs so nested accordions open with hash.
- Child row updates
- Added
tablesorter-hasChildRow
class name to all parents of child rows. - Added
.tablesorter .filtered { display: none; }
to every included theme; needed to properly hide child rows - Fixed pager so that if the last pager row has any child rows, they are now included. Fixes part of issue #396.
- Fixes issue #556.
- Added
- Add
resizable_widths
option- Set the default & reset header widths using this option
- Fixes issue #555.
- I apologize for the last version error... it is set to 2.5.11 instead of 2.15.11 in the git repo tag. It is correct everywhere else.
Version 2.15.11 (3/18/2014)
- Updated Bootstrap to v3.1.1
- Check if cell has parser to catch undefined error. Fixes issue #546. Thanks antila!
- Column count is now correct with nested tables (with tfoot). Fixes issue #547.
- Fix table reset on pagination change. Fixes issue #548. Thanks evanboho!