Author: Christian Bach
Maintainer: Rob Garrison (Mottie)
Version: 2.15.14 (changelog)
Licence:
Dual licensed under MIT
or GPL licenses.
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. It has many useful features including:
Account # |
First Name |
Last Name |
Age |
Total |
Discount |
Difference |
Date |
---|---|---|---|---|---|---|---|
A1 | Bruce | Almighty | 45 | $153.19 | 44.7% | +77 | Jan 18, 2001 9:12 AM |
A33 | Clark | Kent | 18 | $15.89 | 44% | -26 | Jan 12, 2003 11:14 AM |
A42a | Bruce | Evans | 22 | $13.19 | 11% | 0 | Jan 18, 2007 9:12 AM |
A42b | Peter | Parker | 28 | $9.99 | 20.9% | +12.1 | Jul 6, 2006 8:14 AM |
A102 | Bruce | Evans | 22 | $13.19 | 11% | -100.9 | Jan 18, 2007 9:12 AM |
A255 | John | Hood | 33 | $19.99 | 25% | +12 | Dec 10, 2002 5:14 AM |
TIP! Sort multiple columns simultaneously by holding down the Shift key and clicking a second, third or even fourth column header!
To use the tablesorter plugin, include the jQuery
library and the tablesorter plugin inside the <head>
tag
of your HTML document:
<!-- choose a theme file -->
<link rel="stylesheet" href="/path/to/theme.default.css">
<!-- load jQuery and tablesorter scripts -->
<script type="text/javascript" src="/path/to/jquery-latest.js"></script>
<script type="text/javascript" src="/path/to/jquery.tablesorter.js"></script>
<!-- tablesorter widgets (optional) -->
<script type="text/javascript" src="/path/to/jquery.tablesorter.widgets.js"></script>
tablesorter works on standard HTML tables. You must include THEAD and TBODY tags:
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Email</th>
<th>Due</th>
<th>Web Site</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smith</td>
<td>John</td>
<td>jsmith@gmail.com</td>
<td>$50.00</td>
<td>http://www.jsmith.com</td>
</tr>
<tr>
<td>Bach</td>
<td>Frank</td>
<td>fbach@yahoo.com</td>
<td>$50.00</td>
<td>http://www.frank.com</td>
</tr>
<tr>
<td>Doe</td>
<td>Jason</td>
<td>jdoe@hotmail.com</td>
<td>$100.00</td>
<td>http://www.jdoe.com</td>
</tr>
<tr>
<td>Conway</td>
<td>Tim</td>
<td>tconway@earthlink.net</td>
<td>$50.00</td>
<td>http://www.timconway.com</td>
</tr>
</tbody>
</table>
Start by telling tablesorter to sort your table when the document is loaded:
$(function(){
$("#myTable").tablesorter();
});
Click on the headers and you'll see that your table is now sortable! You can also pass in configuration options when you initialize the table. This tells tablesorter to sort on the first and second column in ascending order.
$(function(){
$("#myTable").tablesorter({ sortList: [[0,0], [1,0]] });
});
NOTE! tablesorter will auto-detect most data types including numbers, dates, ip-adresses for more information see Examples
These examples will show what's possible with tablesorter. You need Javascript enabled to run these samples, just like you and your users will need Javascript enabled to use tablesorter.
sortList
)sortInitialOrder
option [demo], or other methods)selectorSort
; v2.4)sortMultiSortKey
)textSorter
; added v2.2; updated v2.12)sortLocaleCompare
; v2.24; languages)delayinit
)stringTo
; v2.0.10)jquery.tablesorter.widgets.js
file (except for extra filter formatter functions)addParser
; Updated v2.15.0)textExtraction
function)addWidget
)update
)addRows
; v2.0.16)thead
and tbody
) (updateAll
; v2.8)updateCell
)onRenderHeader
)headerTemplate
; v2.7)debug
)Property |
Type |
Default |
Description |
Link |
---|---|---|---|---|
Property | Type | Default | Description | Link |
cancelSelection | Boolean | true | Indicates if tablesorter should disable selection of text in the table header (TH). Makes header behave more like a button. | |
cssAsc | String | "" | Additional CSS class applied to style the header with a ascending sort - v2.11. | |
cssChildRow | String | "tablesorter-childRow" | Add this css class to a child row that should always be attached to its parent. Click on the "cssChildRow" link to toggle the view on the attached child row. Previous default was "expand-child" (Changed in v2.4). |
1 2 |
cssDesc | String | "" | Additional CSS class applied to style the header with a descending sort - v2.11. | |
cssHeader | String | "" | Additional CSS class applied to style the headers - v2.11 | |
cssHeaderRow | String | "" | Additional CSS class applied to style the header row - v2.11 | |
cssIcon | String | "tablesorter-icon" | The CSS style used to style the header cell icon (modified v2.7). | |
cssInfoBlock | String | "tablesorter-infoOnly" | All tbodies with this class name will not have its contents sorted. (v2.2). | |
cssNone | String | "" | Additional CSS class applied to style the header when no sort is applied (New v2.15). | |
cssProcessing | String | "" | Additional CSS class applied to style the header cell while it is being sorted or filtered - v2.11 | |
dateFormat | String | "mmddyyyy" | Set the date format. Here are the available options. (Modified v2.0.23). | Example |
debug | Boolean | false | Boolean flag indicating if tablesorter should display debuging information useful for development. | Example |
delayInit | Boolean | false | Setting this option to true will delay parsing of all table cell data until the user initializes a sort. This speeds up the initialization process of very large tables, but the data still needs to be parsed, so the delay is still present upon initial sort. | Example |
emptyTo | String | "bottom" | Boolean flag indicating how tablesorter should deal with empty table cells. (Modified v2.1.16). | Example |
headers | Object | null |
An object of instructions for per-"header cell" controls in the format: headers: { 0: { option: setting }, ... }
docs updated
|
1 2 3 4 |
headerTemplate | String | "{content}" | This is a template string which allows adding additional content to the header while it is being built (v2.7). | Example |
ignoreCase | Boolean | true | When true, text sorting will ignore the character case. If false, upper case characters will sort before lower case. (v2.2). | |
initWidgets | Boolean | true | Apply widgets after table initializes (v2.3.5). | |
namespace | String | Undefined | This option should contain a unique namespace for each table; it is used when binding to event listeners. New v2.15.7. | |
numberSorter | Function | null | Replace the default number sorting algorithm with a custom one using this option v2.12. | |
onRenderHeader | Function | null | This function is called after content is to the TH tags (after the template is procressed and added). You can use this to modify the HTML in each header tag for additional styling. | Example |
onRenderTemplate | Function | null |
This function is called after the template string has been built, but before the template string is applied to the header and before the onRenderHeader function is called (v2.7).
|
Example |
selectorHeaders | String | "> thead th, > thead td" | jQuery selectors used to find cells in the header. | |
selectorRemove | String | "tr.remove-me" | This CSS class name can be applied to all rows that are to be removed prior to triggering a table update. (v2.1). | |
selectorSort | String | "th, td" | jQuery selector of content within selectorHeaders that is clickable to trigger a sort (v2.4). |
Example |
serverSideSorting | Boolean | false | Set to true if the server is performing the sorting. The ui and events will still be used (v2.5.3). |
|
showProcessing | Boolean | false | Show an indeterminate timer icon in the header when the table is sorted or filtered. Please note that due to javascript processing, the icon may not show as being animated. I'm looking into this further and would appreciate any feedback or suggestions with the coding (v2.4). | Example |
sortAppend | Array | null | Use to add an additional forced sort that will be appended to the dynamic selections by the user. | Example |
sortForce | Array | null | Use to add an additional forced sort that is prepended to sortList .
|
Example |
sortInitialOrder | String | "asc" |
This sets the direction a column will sort when clicking on the header for the first time. Valid arguments are "asc" for Ascending or "desc" for Descending. |
1 2 |
sortList | Array | null | Use to add an initial sort to the table. | Example |
sortLocaleCompare | Boolean | false | Boolean flag indicating if certain accented characters within the table will be replaced with their equivalent characters. (Modified v2.2). | Example |
sortMultiSortKey | String | "shiftKey" | The key used to select more than one column for multi-column sorting. Defaults to the Shift key. The other options are "ctrlKey" or "altKey" (reference). |
Example |
sortReset | Boolean | false |
Setting this option to true will allow you to click on the table header a third time to reset the sort direction. (v2.0.27).
|
Example |
sortResetKey | String | "ctrlKey" | The key used to reset sorting on the entire table. Defaults to the control key. The other options are "shiftKey" or "altKey" (reference). |
|
sortRestart | Boolean | false |
Setting this option to true will start the sort with the sortInitialOrder when clicking on a previously unsorted column. (v2.0.31).
|
Example |
sortStable | Boolean | false |
Setting this option to true and sorting two rows with exactly the same content, the original sort order is maintained (New v2.14).
|
|
stringTo | String | "max" | A key word indicating how tablesorter should deal with text inside of numerically sorted columns. (v2.1.16). | Example |
tabIndex | Boolean | true | Add a tabindex to the headers for keyboard accessibility; this was previously always applied New v2.14 | |
tableClass | String | "" | Additional CSS class applied to style the table - v2.11 | |
textExtraction | String Or Function | "simple" | Defines which method is used to extract data from a table cell for sorting.
The built-in option is "simple" which is the equivalent of doing this inside of the textExtraction function: $(node).text(); .
|
Example |
textSorter | Function | null | Replace the default sorting algorithm with a custom one using this option (v2.12) - *NOTE* The parameters have changed!!. | 1 2 |
theme | String | "default" | This option will add a theme css class name to the table "tablesorter-{theme}" for styling (v2.4).
|
Example |
usNumberFormat | Boolean | true | Indicates how tablesorter should deal with a numerical format: (v2.1.3). | Example |
widgetOptions | Object | { } | In version 2.1, all widget options have been moved into this option. This is a move to store all widget specific options in one place so as not to polute the main table options. All current widgets have been modified to use this new option. (v2.1). | Example |
widgets | Array | [ ] (empty array) |
Initialize widgets using this option ( e.g. widgets : ['zebra'] , or custom widgets widgets: ['zebra', 'myCustomWidget']; , see this demo on how to write your own custom widget ).
|
Example |
widthFixed | Boolean | false | Indicates if tablesorter should apply fixed percentage-based widths to the table columns (modified v2.4). | Example |
Utility Options | ||||
data | Object, Array | undefined | Storage for processed table build widget data (array, object, string) (v2.11). | Example |
dateRange | Numeric | 50 | Used by the two digit year parser to set the date range New v2.14. | Example |
fixedUrl | String | Undefined |
This option was added to set a specific page when storing data using the $.tablesorter.storage code. v2.12.
|
|
Deprecated Options | ||||
widgetColumns | Object with Array | { css:[ "primary", "secondary", "tertiary" ] } |
This option is being deprecated!
It has been replaced by widgetOptions.columns ; but is still available for backwards compatibility.
|
|
widgetUitheme | Object with Array | { css: [ "ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n" ] } |
This option is being deprecated!
It has been replaced by widgetOptions.uitheme ; but is still available for backwards compatibility.
|
|
widgetZebra | Object with Array | { css: [ "even", "odd" ] } |
This option is being deprecated!
It has been replaced by widgetOptions.zebra ; but is still available for backwards compatibility.
|
Property |
Type |
Default |
Description |
Link |
---|---|---|---|---|
Property | Type | Default | Description | Link |
cancelSelection | Boolean | true | Indicates if tablesorter should disable selection of text in the table header (TH). Makes header behave more like a button. | |
cssAsc | String | "" | Additional CSS class applied to style the header with a ascending sort - v2.11. | |
cssChildRow | String | "tablesorter-childRow" | Add this css class to a child row that should always be attached to its parent. Click on the "cssChildRow" link to toggle the view on the attached child row. Previous default was "expand-child" (Changed in v2.4). |
1 2 |
cssDesc | String | "" | Additional CSS class applied to style the header with a descending sort - v2.11. | |
cssHeader | String | "" | Additional CSS class applied to style the headers - v2.11 | |
cssHeaderRow | String | "" | Additional CSS class applied to style the header row - v2.11 | |
cssIcon | String | "tablesorter-icon" | The CSS style used to style the header cell icon (modified v2.7). | |
cssInfoBlock | String | "tablesorter-infoOnly" | All tbodies with this class name will not have its contents sorted. (v2.2). | |
cssNone | String | "" | Additional CSS class applied to style the header when no sort is applied (New v2.15). | |
cssProcessing | String | "" | Additional CSS class applied to style the header cell while it is being sorted or filtered - v2.11 | |
dateFormat | String | "mmddyyyy" | Set the date format. Here are the available options. (Modified v2.0.23). | Example |
debug | Boolean | false | Boolean flag indicating if tablesorter should display debuging information useful for development. | Example |
delayInit | Boolean | false | Setting this option to true will delay parsing of all table cell data until the user initializes a sort. This speeds up the initialization process of very large tables, but the data still needs to be parsed, so the delay is still present upon initial sort. | Example |
emptyTo | String | "bottom" | Boolean flag indicating how tablesorter should deal with empty table cells. (Modified v2.1.16). | Example |
headers | Object | null |
An object of instructions for per-"header cell" controls in the format: headers: { 0: { option: setting }, ... }
docs updated
|
1 2 3 4 |
headerTemplate | String | "{content}" | This is a template string which allows adding additional content to the header while it is being built (v2.7). | Example |
ignoreCase | Boolean | true | When true, text sorting will ignore the character case. If false, upper case characters will sort before lower case. (v2.2). | |
initWidgets | Boolean | true | Apply widgets after table initializes (v2.3.5). | |
namespace | String | Undefined | This option should contain a unique namespace for each table; it is used when binding to event listeners. New v2.15.7. | |
numberSorter | Function | null | Replace the default number sorting algorithm with a custom one using this option v2.12. | |
onRenderHeader | Function | null | This function is called after content is to the TH tags (after the template is procressed and added). You can use this to modify the HTML in each header tag for additional styling. | Example |
onRenderTemplate | Function | null |
This function is called after the template string has been built, but before the template string is applied to the header and before the onRenderHeader function is called (v2.7).
|
Example |
selectorHeaders | String | "> thead th, > thead td" | jQuery selectors used to find cells in the header. | |
selectorRemove | String | "tr.remove-me" | This CSS class name can be applied to all rows that are to be removed prior to triggering a table update. (v2.1). | |
selectorSort | String | "th, td" | jQuery selector of content within selectorHeaders that is clickable to trigger a sort (v2.4). |
Example |
serverSideSorting | Boolean | false | Set to true if the server is performing the sorting. The ui and events will still be used (v2.5.3). |
|
showProcessing | Boolean | false | Show an indeterminate timer icon in the header when the table is sorted or filtered. Please note that due to javascript processing, the icon may not show as being animated. I'm looking into this further and would appreciate any feedback or suggestions with the coding (v2.4). | Example |
sortAppend | Array | null | Use to add an additional forced sort that will be appended to the dynamic selections by the user. | Example |
sortForce | Array | null | Use to add an additional forced sort that is prepended to sortList .
|
Example |
sortInitialOrder | String | "asc" |
This sets the direction a column will sort when clicking on the header for the first time. Valid arguments are "asc" for Ascending or "desc" for Descending. |
1 2 |
sortList | Array | null | Use to add an initial sort to the table. | Example |
sortLocaleCompare | Boolean | false | Boolean flag indicating if certain accented characters within the table will be replaced with their equivalent characters. (Modified v2.2). | Example |
sortMultiSortKey | String | "shiftKey" | The key used to select more than one column for multi-column sorting. Defaults to the Shift key. The other options are "ctrlKey" or "altKey" (reference). |
Example |
sortReset | Boolean | false |
Setting this option to true will allow you to click on the table header a third time to reset the sort direction. (v2.0.27).
|
Example |
sortResetKey | String | "ctrlKey" | The key used to reset sorting on the entire table. Defaults to the control key. The other options are "shiftKey" or "altKey" (reference). |
|
sortRestart | Boolean | false |
Setting this option to true will start the sort with the sortInitialOrder when clicking on a previously unsorted column. (v2.0.31).
|
Example |
sortStable | Boolean | false |
Setting this option to true and sorting two rows with exactly the same content, the original sort order is maintained (New v2.14).
|
|
stringTo | String | "max" | A key word indicating how tablesorter should deal with text inside of numerically sorted columns. (v2.1.16). | Example |
tabIndex | Boolean | true | Add a tabindex to the headers for keyboard accessibility; this was previously always applied New v2.14 | |
tableClass | String | "" | Additional CSS class applied to style the table - v2.11 | |
textExtraction | String Or Function | "simple" | Defines which method is used to extract data from a table cell for sorting.
The built-in option is "simple" which is the equivalent of doing this inside of the textExtraction function: $(node).text(); .
|
Example |
textSorter | Function | null | Replace the default sorting algorithm with a custom one using this option (v2.12) - *NOTE* The parameters have changed!!. | 1 2 |
theme | String | "default" | This option will add a theme css class name to the table "tablesorter-{theme}" for styling (v2.4).
|
Example |
usNumberFormat | Boolean | true | Indicates how tablesorter should deal with a numerical format: (v2.1.3). | Example |
widgetOptions | Object | { } | In version 2.1, all widget options have been moved into this option. This is a move to store all widget specific options in one place so as not to polute the main table options. All current widgets have been modified to use this new option. (v2.1). | Example |
widgets | Array | [ ] (empty array) |
Initialize widgets using this option ( e.g. widgets : ['zebra'] , or custom widgets widgets: ['zebra', 'myCustomWidget']; , see this demo on how to write your own custom widget ).
|
Example |
widthFixed | Boolean | false | Indicates if tablesorter should apply fixed percentage-based widths to the table columns (modified v2.4). | Example |
Utility Options | ||||
data | Object, Array | undefined | Storage for processed table build widget data (array, object, string) (v2.11). | Example |
dateRange | Numeric | 50 | Used by the two digit year parser to set the date range New v2.14. | Example |
fixedUrl | String | Undefined |
This option was added to set a specific page when storing data using the $.tablesorter.storage code. v2.12.
|
|
Deprecated Options | ||||
widgetColumns | Object with Array | { css:[ "primary", "secondary", "tertiary" ] } |
This option is being deprecated!
It has been replaced by widgetOptions.columns ; but is still available for backwards compatibility.
|
|
widgetUitheme | Object with Array | { css: [ "ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n" ] } |
This option is being deprecated!
It has been replaced by widgetOptions.uitheme ; but is still available for backwards compatibility.
|
|
widgetZebra | Object with Array | { css: [ "even", "odd" ] } |
This option is being deprecated!
It has been replaced by widgetOptions.zebra ; but is still available for backwards compatibility.
|
Widget Priority | Name | Requires jQuery | Limiting function |
---|---|---|---|
10 | uitheme | v1.2.6 | |
20 | saveSort | v1.4.1 | 1.4.1 (parseJSON)* |
30 | columns | v1.2.6 | |
40 | resizable | v1.4.1* | 1.4 (isEmptyObject); 1.4.1 (parseJSON)* |
50 | filter | v1.4.3 | 1.4.3 (nextUntil & delegate) |
60 | stickyHeaders | v1.2.6 | |
90 | zebra | v1.2.6 | |
Last | pager | v1.2.6 |
widgetOptions
. Thanks to thezoggy for putting together this jQuery-widget compatibility table, but please note:
10
.saveSort
and resizable
widgets use the $.tablesorter.storage
function by default and thus need the parseJSON
function which is available in jQuery 1.4.1+.Property |
Type |
Default |
Description |
Link |
---|---|---|---|---|
Property | Type | Default | Description | Link |
columns | Array | [ "primary", "secondary", "tertiary" ] |
Columns widget: When the column styling widget is initialized, it automatically applied the default class names of "primary" for the primary sort, "secondary" for the next sort, "tertiary" for the next sort, and so on (add more as needed)... (Modified v2.1).
|
Example |
columns_tfoot | Boolean | true |
Columns widget: If true, the class names from the columns option will also be added to the table tfoot (v2.4).
|
Example |
columns_thead | Boolean | true |
Columns widget: If true, the class names from the columns option will also be added to the table thead (v2.4).
|
Example |
filter_childRows | Boolean | false |
Filter widget: If there are child rows in the table (rows with class name from "cssChildRow" option) and this option is true and a match is found anywhere in the child row, then it will make that row visible.
(Modified v2.1).
|
|
filter_columnFilters | Boolean | true |
Filter widget: If true , a filter will be added to the top of each table column (v2.4).
|
|
filter_cssFilter | String or Array | "" | Additional CSS class applied to each filter - Updated v2.15 | Example |
filter_defaultAttrib | String | "data-value" | Filter widget: This option contains the name of the data-attribute which contains the default (starting) filter value (v2.10.8). | Example |
filter_external | String | "" | Filter widget: jQuery selector string of inputs, outside of the table, to be used for searching table content (New v2.15). | Example |
filter_filteredRow | String | "filtered" | Filter widget: This is the class name applied to all rows that do not match the filter (hidden rows); used by pager plugin (v2.10). | |
filter_formatter | Object | null |
Filter widget: This option allows you to add custom controls within the filter widget row (v2.7.7). |
1 2 |
filter_functions | Object | null | Filter widget: Customize the filter widget by adding a select dropdown with content, custom options or custom filter functions (v2.3.6). | Example |
filter_hideEmpty | Boolean | true |
Filter widget: Set this option to false to always show the filter row; by default, the filter row is completely hidden when no rows exist within the tbody (New v2.15).
|
|
filter_hideFilters | Boolean | false |
Filter widget: Set this option to true to hide the filter row initially. The row is revealed by hovering over the visible portion of the filter row or by giving any filter input/select focus (tab key) (v2.4).
|
Example |
filter_ignoreCase | Boolean | true |
Filter widget: Set this option to false to make the column content search case-insensitive, so typing in "a" will not find "Albert". (v2.3.4)
|
Example |
filter_liveSearch | Boolean, or Number | true |
Filter widget: If true , a search of the column content will occur as the user types, with the delay set in the filter_searchDelay option (v2.9; v2.10).
|
|
filter_onlyAvail | String | "filter-onlyAvail" | Filter widget: If a header contains a select dropdown and this class name, only the available (visible) options in the column will show (v2.10.1). | Example |
filter_reset | String | null | Filter widget: jQuery selector string of an element used to reset the filters (v2.4). | Example |
filter_saveFilters | Boolean | false |
Filter widget: If the storage utility is available (included with jquery.tablesorter.widgets.js file, the last applied filter is saved to storage (New v2.14).
|
Example |
filter_searchDelay | Numeric | 300 | Filter widget: Set this option to the number of milliseconds to delay the search. (v2.3.4). | |
filter_serversideFiltering | Boolean | false |
Filter widget: Set this option to true if filtering is performed on the server-side (v2.5.3).
|
|
filter_startsWith | Boolean | false |
Filter widget: Set this option to true to use the filter to find text from the start of the column, so typing in "a" will find "albert" but not "frank", both have a's. (v2.1).
|
Example |
filter_useParsedData | Boolean | false |
Filter widget: If true , ALL filter searches will only use parsed data (v2.4).
|
|
resizable | Boolean | true |
Resizable widget: If this option is set to false , resized column widths will not be saved. Previous saved values will be restored on page reload (v2.4).
|
Example |
resizable_addLastColumn | Boolean | false |
Resizable widget: If this option is set to true , a resizing anchor will be included in the last column of the table (v2.8.3).
|
Example |
resizable_widths | Array | [] | Resizable widget: Set this option to the starting & reset header widths (New v2.15.12). | Example |
saveSort | Boolean | true |
saveSort widget: If this option is set to false , new sorts will not be saved. Any previous saved sort will be restored on page reload (v2.4).
|
Example |
stickyHeaders | String | "" | Sticky Headers widget: This additional CSS class applied to the sticky header row - v2.11 | Example |
stickyHeaders_addResizeEvent | Boolean | true |
Sticky Headers widget: If true , sticky table headers will resize automatically when content is added to or removed from the table headers (v2.10).
|
|
stickyHeaders_attachTo | String | null | Sticky Headers widget: points to the table wrapper to stick the headers to while scrolling. Use this option to point to their needs (New v2.14.4). | Example |
stickyHeaders_cloneId | String | "-sticky" | Sticky Headers widget: If the table has an ID defined, the suffix from this option will be added to the ID in the cloned sticky table (v2.9). | |
stickyHeaders_includeCaption | Boolean | true |
Sticky Headers widget: If this option is false and a caption exists, it will not be included in the sticky header (v2.10.8).
|
Example |
stickyHeaders_offset | Multiple | 0 | Sticky Headers widget: Set the sticky header offset from the top as a Number or jQuery selector string or object (v2.10). | |
stickyHeaders_zIndex | Numeric | 2 | Sticky Headers widget: The zIndex added to the stickyHeaders. This option allows the user to adjust the value to their needs (v2.11). | |
uitheme | String | "jui" | This option contains the name of the theme. Currently jQuery UI ("jui") and Bootstrap ("bootstrap") themes are supported (updated v2.4) | Example |
zebra | Array | [ "even", "odd" ] |
zebra widget: When the zebra striping widget is initialized, it automatically applied the default class names of "even" and "odd" . (Modified v2.1).
|
Example |
Pager | ||||
ajaxObject | Object | { dataType: 'json' } | This option contains the ajax settings for the pager interaction with your database (v2.10). | Example |
ajaxProcessing | Function | null | This function is required to return the ajax data obtained from your server into a useable format for tablesorter to apply to the table (v2.1, Updated v2.14.3). | Example |
ajaxUrl | String | null | Set this option to include a url template to use so that the pager plugin can interact with your database (Added v2.1; v2.9). | Example |
container | Object | null | Target your one or more pager markup blocks by setting this option with a jQuery selector. | Example |
countChildRows | Boolean | false |
If true , child rows will be counted towards the pager set size (v2.13).
|
|
cssDisabled | String | "disabled" | This option contains the class name that is applied to disabled pager controls. | |
cssErrorRow | String | "tablesorter-errorRow" | This option contains the class name that is applied to the error information row that is added inside the pager with any ajax exceptions. | |
cssFirst | String | ".first" | This option contains a jQuery selector string pointing to the go to first page arrow. See container for full HTML. |
Example |
cssGoto | String | ".gotoPage" | This option contains a jQuery selector string pointing to the page select dropdown. See container for full HTML (v2.4)
|
Example |
cssLast | String | ".last" | This option contains a jQuery selector string pointing to the go to last page arrow. See container for full HTML. |
Example |
cssNext | String | ".next" | This option contains a jQuery selector string pointing to the go to next page arrow. See container for full HTML. |
Example |
cssPageDisplay | String | ".pagedisplay" | This option contains a jQuery selector string pointing to the output element (v2.0.9) | Example |
cssPageSize | String | ".pagesize" | This option contains a jQuery selector string pointing to the page size selector. See container for full HTML. |
Example |
cssPrev | String | ".prev" | This option contains a jQuery selector string pointing to the go to previous page arrow. See container for full HTML. |
Example |
customAjaxUrl | Function | function(table, url) { return url; } | This callback function allows you to modify the processed URL as desired (v2.8.1). | Example |
fixedHeight | Boolean | false | Maintain the height of the table even when fewer than the set number of records is shown (v2.1; updated 2.7.1). | Example |
output | String | "{page}/{totalPages}" | This option allows you to format the output display which can show the current page, total pages, filtered pages, current start and end rows, total rows and filtered rows (v2.0.9). | 1 2 3 4 |
page | Numeric | 0 | Set the starting page of the pager (zero-based index). | Example |
processAjaxOnInit | Boolean | true |
Set this option to false if your table data is preloaded into the table, but you are still using ajax (New v2.14.5).
|
|
removeRows | Boolean | false |
If true , rows are removed from the table to speed up the sort of large tables (v2.0.21).
|
Example |
savePages | Boolean | true | Saves the current pager page size and number. This option requires the $.tablesorter.storage script in the jquery.tablesorter.widgets.js file (v2.11). |
Example |
size | Numeric | 10 | Set initial number of visible rows. This value is changed by the dropdown selector targeted by the cssPageSize option. |
Example |
storageKey | String | "tablesorter-pager" | Saves tablesorter paging to custom key if defined. Key parameter name used by the $.tablesorter.storage function. Useful if you have multiple tables defined (New v2.15) |
Example |
updateArrows | Boolean | true |
If true , the addon hides the left pager arrow on the first page and right pager arrow on the last page.
|
Example |
Removed Options | ||||
filter_anyMatch | Boolean | false | Filter widget: This option was removed in Updated v2.15... sorry for the sudden notice. | |
offset | Numeric | 0 | This pager plugin option has been removed! | |
positionFixed | Boolean | true | This pager plugin option has been removed! | |
seperator | String | "/" | This pager plugin option has been removed! Use the output option to allow for more control over the formatting. |
Property |
Type |
Default |
Description |
Link |
---|---|---|---|---|
Property | Type | Default | Description | Link |
columns | Array | [ "primary", "secondary", "tertiary" ] |
Columns widget: When the column styling widget is initialized, it automatically applied the default class names of "primary" for the primary sort, "secondary" for the next sort, "tertiary" for the next sort, and so on (add more as needed)... (Modified v2.1).
|
Example |
columns_tfoot | Boolean | true |
Columns widget: If true, the class names from the columns option will also be added to the table tfoot (v2.4).
|
Example |
columns_thead | Boolean | true |
Columns widget: If true, the class names from the columns option will also be added to the table thead (v2.4).
|
Example |
filter_childRows | Boolean | false |
Filter widget: If there are child rows in the table (rows with class name from "cssChildRow" option) and this option is true and a match is found anywhere in the child row, then it will make that row visible.
(Modified v2.1).
|
|
filter_columnFilters | Boolean | true |
Filter widget: If true , a filter will be added to the top of each table column (v2.4).
|
|
filter_cssFilter | String or Array | "" | Additional CSS class applied to each filter - Updated v2.15 | Example |
filter_defaultAttrib | String | "data-value" | Filter widget: This option contains the name of the data-attribute which contains the default (starting) filter value (v2.10.8). | Example |
filter_external | String | "" | Filter widget: jQuery selector string of inputs, outside of the table, to be used for searching table content (New v2.15). | Example |
filter_filteredRow | String | "filtered" | Filter widget: This is the class name applied to all rows that do not match the filter (hidden rows); used by pager plugin (v2.10). | |
filter_formatter | Object | null |
Filter widget: This option allows you to add custom controls within the filter widget row (v2.7.7). |
1 2 |
filter_functions | Object | null | Filter widget: Customize the filter widget by adding a select dropdown with content, custom options or custom filter functions (v2.3.6). | Example |
filter_hideEmpty | Boolean | true |
Filter widget: Set this option to false to always show the filter row; by default, the filter row is completely hidden when no rows exist within the tbody (New v2.15).
|
|
filter_hideFilters | Boolean | false |
Filter widget: Set this option to true to hide the filter row initially. The row is revealed by hovering over the visible portion of the filter row or by giving any filter input/select focus (tab key) (v2.4).
|
Example |
filter_ignoreCase | Boolean | true |
Filter widget: Set this option to false to make the column content search case-insensitive, so typing in "a" will not find "Albert". (v2.3.4)
|
Example |
filter_liveSearch | Boolean, or Number | true |
Filter widget: If true , a search of the column content will occur as the user types, with the delay set in the filter_searchDelay option (v2.9; v2.10).
|
|
filter_onlyAvail | String | "filter-onlyAvail" | Filter widget: If a header contains a select dropdown and this class name, only the available (visible) options in the column will show (v2.10.1). | Example |
filter_reset | String | null | Filter widget: jQuery selector string of an element used to reset the filters (v2.4). | Example |
filter_saveFilters | Boolean | false |
Filter widget: If the storage utility is available (included with jquery.tablesorter.widgets.js file, the last applied filter is saved to storage (New v2.14).
|
Example |
filter_searchDelay | Numeric | 300 | Filter widget: Set this option to the number of milliseconds to delay the search. (v2.3.4). | |
filter_serversideFiltering | Boolean | false |
Filter widget: Set this option to true if filtering is performed on the server-side (v2.5.3).
|
|
filter_startsWith | Boolean | false |
Filter widget: Set this option to true to use the filter to find text from the start of the column, so typing in "a" will find "albert" but not "frank", both have a's. (v2.1).
|
Example |
filter_useParsedData | Boolean | false |
Filter widget: If true , ALL filter searches will only use parsed data (v2.4).
|
|
resizable | Boolean | true |
Resizable widget: If this option is set to false , resized column widths will not be saved. Previous saved values will be restored on page reload (v2.4).
|
Example |
resizable_addLastColumn | Boolean | false |
Resizable widget: If this option is set to true , a resizing anchor will be included in the last column of the table (v2.8.3).
|
Example |
resizable_widths | Array | [] | Resizable widget: Set this option to the starting & reset header widths (New v2.15.12). | Example |
saveSort | Boolean | true |
saveSort widget: If this option is set to false , new sorts will not be saved. Any previous saved sort will be restored on page reload (v2.4).
|
Example |
stickyHeaders | String | "" | Sticky Headers widget: This additional CSS class applied to the sticky header row - v2.11 | Example |
stickyHeaders_addResizeEvent | Boolean | true |
Sticky Headers widget: If true , sticky table headers will resize automatically when content is added to or removed from the table headers (v2.10).
|
|
stickyHeaders_attachTo | String | null | Sticky Headers widget: points to the table wrapper to stick the headers to while scrolling. Use this option to point to their needs (New v2.14.4). | Example |
stickyHeaders_cloneId | String | "-sticky" | Sticky Headers widget: If the table has an ID defined, the suffix from this option will be added to the ID in the cloned sticky table (v2.9). | |
stickyHeaders_includeCaption | Boolean | true |
Sticky Headers widget: If this option is false and a caption exists, it will not be included in the sticky header (v2.10.8).
|
Example |
stickyHeaders_offset | Multiple | 0 | Sticky Headers widget: Set the sticky header offset from the top as a Number or jQuery selector string or object (v2.10). | |
stickyHeaders_zIndex | Numeric | 2 | Sticky Headers widget: The zIndex added to the stickyHeaders. This option allows the user to adjust the value to their needs (v2.11). | |
uitheme | String | "jui" | This option contains the name of the theme. Currently jQuery UI ("jui") and Bootstrap ("bootstrap") themes are supported (updated v2.4) | Example |
zebra | Array | [ "even", "odd" ] |
zebra widget: When the zebra striping widget is initialized, it automatically applied the default class names of "even" and "odd" . (Modified v2.1).
|
Example |
Pager | ||||
ajaxObject | Object | { dataType: 'json' } | This option contains the ajax settings for the pager interaction with your database (v2.10). | Example |
ajaxProcessing | Function | null | This function is required to return the ajax data obtained from your server into a useable format for tablesorter to apply to the table (v2.1, Updated v2.14.3). | Example |
ajaxUrl | String | null | Set this option to include a url template to use so that the pager plugin can interact with your database (Added v2.1; v2.9). | Example |
container | Object | null | Target your one or more pager markup blocks by setting this option with a jQuery selector. | Example |
countChildRows | Boolean | false |
If true , child rows will be counted towards the pager set size (v2.13).
|
|
cssDisabled | String | "disabled" | This option contains the class name that is applied to disabled pager controls. | |
cssErrorRow | String | "tablesorter-errorRow" | This option contains the class name that is applied to the error information row that is added inside the pager with any ajax exceptions. | |
cssFirst | String | ".first" | This option contains a jQuery selector string pointing to the go to first page arrow. See container for full HTML. |
Example |
cssGoto | String | ".gotoPage" | This option contains a jQuery selector string pointing to the page select dropdown. See container for full HTML (v2.4)
|
Example |
cssLast | String | ".last" | This option contains a jQuery selector string pointing to the go to last page arrow. See container for full HTML. |
Example |
cssNext | String | ".next" | This option contains a jQuery selector string pointing to the go to next page arrow. See container for full HTML. |
Example |
cssPageDisplay | String | ".pagedisplay" | This option contains a jQuery selector string pointing to the output element (v2.0.9) | Example |
cssPageSize | String | ".pagesize" | This option contains a jQuery selector string pointing to the page size selector. See container for full HTML. |
Example |
cssPrev | String | ".prev" | This option contains a jQuery selector string pointing to the go to previous page arrow. See container for full HTML. |
Example |
customAjaxUrl | Function | function(table, url) { return url; } | This callback function allows you to modify the processed URL as desired (v2.8.1). | Example |
fixedHeight | Boolean | false | Maintain the height of the table even when fewer than the set number of records is shown (v2.1; updated 2.7.1). | Example |
output | String | "{page}/{totalPages}" | This option allows you to format the output display which can show the current page, total pages, filtered pages, current start and end rows, total rows and filtered rows (v2.0.9). | 1 2 3 4 |
page | Numeric | 0 | Set the starting page of the pager (zero-based index). | Example |
processAjaxOnInit | Boolean | true |
Set this option to false if your table data is preloaded into the table, but you are still using ajax (New v2.14.5).
|
|
removeRows | Boolean | false |
If true , rows are removed from the table to speed up the sort of large tables (v2.0.21).
|
Example |
savePages | Boolean | true | Saves the current pager page size and number. This option requires the $.tablesorter.storage script in the jquery.tablesorter.widgets.js file (v2.11). |
Example |
size | Numeric | 10 | Set initial number of visible rows. This value is changed by the dropdown selector targeted by the cssPageSize option. |
Example |
storageKey | String | "tablesorter-pager" | Saves tablesorter paging to custom key if defined. Key parameter name used by the $.tablesorter.storage function. Useful if you have multiple tables defined (New v2.15) |
Example |
updateArrows | Boolean | true |
If true , the addon hides the left pager arrow on the first page and right pager arrow on the last page.
|
Example |
Removed Options | ||||
filter_anyMatch | Boolean | false | Filter widget: This option was removed in Updated v2.15... sorry for the sudden notice. | |
offset | Numeric | 0 | This pager plugin option has been removed! | |
positionFixed | Boolean | true | This pager plugin option has been removed! | |
seperator | String | "/" | This pager plugin option has been removed! Use the output option to allow for more control over the formatting. |
Method |
Description |
Link |
---|---|---|
addRows | Use this method to add table rows. (v2.0.16). | Example |
appendCache | Adds all of the cached table rows back into the table. |
|
applyWidgetId | Apply the selected widget to the table, but the widget will not continue to be applied after each sort. See the example, it's easier than describing it. | Example |
applyWidgets | Apply the set widgets to the table. This method can be used after a table has been initialized, but it won't work unless you update the configuration settings. See the example, it's easier than describing it. | Example |
destroy | Use this method to remove tablesorter from the table. | |
refreshWidgets | Refresh the currently applied widgets. Depending on the options, it will completely remove all widgets, then re-initialize the current widgets or just remove all non-current widgets (v2.4). | Example |
sort | Use this method to initialize a sort while targeting a specific column header (v2.9). | |
sorton | Use this method to sort an initialized table in the desired order. | Example |
sortReset | Use this method to reset the table to it's initial unsorted state (v2.4.7). | Example |
update / updateRows | Update the tbody 's stored data (update & updateRows do exactly the same thing)
|
Example |
updateAll | Update a column of cells (thead and tbody ) (v2.8).
|
Example |
updateCache | Update the parsers, only if not defined, then update the internal cache (New v2.15.4). | Example |
updateCell | Update a table cell in the tablesorter data. | Example |
Widget Methods | ||
filterReset | filter: Trigger the filter widget to reset the search criteria (v2.7.7). | Example |
saveSortReset | Trigger the saveSort widget to clear any saved sorts for that specific table (v2.7.11). | |
search | filter: Trigger the filter widget to update the search from current inputs and/or selections (v2.4; Updated v2.15). | |
Pager Methods | ||
destroy.pager | Calling this method will reveal the entire table, remove the pager functionality, and hide the actual pager (v2.0.16). | Example |
disable.pager | This method will put the pager into a disabled state (v2.0.21.2). | Example |
enable.pager | This method will re-enable the pager, but only from the disabled state (v2.0.21.2). | Example |
pageSet | Trigger the pager to change the current page (v2.7.7). | |
pageSize | Trigger the pager to change the page size (v2.7.4). |
Method |
Description |
Link |
---|---|---|
addRows | Use this method to add table rows. (v2.0.16). | Example |
appendCache | Adds all of the cached table rows back into the table. |
|
applyWidgetId | Apply the selected widget to the table, but the widget will not continue to be applied after each sort. See the example, it's easier than describing it. | Example |
applyWidgets | Apply the set widgets to the table. This method can be used after a table has been initialized, but it won't work unless you update the configuration settings. See the example, it's easier than describing it. | Example |
destroy | Use this method to remove tablesorter from the table. | |
refreshWidgets | Refresh the currently applied widgets. Depending on the options, it will completely remove all widgets, then re-initialize the current widgets or just remove all non-current widgets (v2.4). | Example |
sort | Use this method to initialize a sort while targeting a specific column header (v2.9). | |
sorton | Use this method to sort an initialized table in the desired order. | Example |
sortReset | Use this method to reset the table to it's initial unsorted state (v2.4.7). | Example |
update / updateRows | Update the tbody 's stored data (update & updateRows do exactly the same thing)
|
Example |
updateAll | Update a column of cells (thead and tbody ) (v2.8).
|
Example |
updateCache | Update the parsers, only if not defined, then update the internal cache (New v2.15.4). | Example |
updateCell | Update a table cell in the tablesorter data. | Example |
Widget Methods | ||
filterReset | filter: Trigger the filter widget to reset the search criteria (v2.7.7). | Example |
saveSortReset | Trigger the saveSort widget to clear any saved sorts for that specific table (v2.7.11). | |
search | filter: Trigger the filter widget to update the search from current inputs and/or selections (v2.4; Updated v2.15). | |
Pager Methods | ||
destroy.pager | Calling this method will reveal the entire table, remove the pager functionality, and hide the actual pager (v2.0.16). | Example |
disable.pager | This method will put the pager into a disabled state (v2.0.21.2). | Example |
enable.pager | This method will re-enable the pager, but only from the disabled state (v2.0.21.2). | Example |
pageSet | Trigger the pager to change the current page (v2.7.7). | |
pageSize | Trigger the pager to change the page size (v2.7.4). |
Event |
Description |
Link |
---|---|---|
initialized | This event fires when tablesorter has completed initialization. (v2.2). | |
sortBegin | This event fires immediately before tablesorter begins resorting the table. | |
sortEnd | This event fires when tablesorter has completed resorting the table. | Example |
sortStart | This event fires immediately after the tablesorter header has been clicked, initializing a resort. | Example |
updateComplete | This event fires after tablesorter has completed updating. (v.2.3.9) | |
Widget Events | ||
filterEnd | Event triggered when the filter widget has finished processing the search (v2.4). | Example |
filterInit | Event triggered when the filter widget has finished initializing (v2.4). | Example |
filterStart | Event triggered when the filter widget has started processing the search (v2.4). | Example |
stickyHeadersInit | Event triggered when the stickyHeader widget has finished initializing (v2.10.4). | |
Pager Events | ||
pageMoved | This event fires when the pager plugin begins to change to the selected page (v2.4.4). | Example |
pagerBeforeInitialized | This event fires after all pager controls have been bound and set up but before the pager formats the table or loads any ajax data (v2.4.4). | |
pagerChange | This event fires when the pager plugin begins to render the table on the currently selected page. (v2.0.7). | Example |
pagerComplete | This event fires when the pager plugin has completed its render of the table on the currently selected page. (v2.0.7). | Example |
pagerInitialized | This event fires when the pager plugin has completed initialization (v2.4.4). | Example |
Event |
Description |
Link |
---|---|---|
initialized | This event fires when tablesorter has completed initialization. (v2.2). | |
sortBegin | This event fires immediately before tablesorter begins resorting the table. | |
sortEnd | This event fires when tablesorter has completed resorting the table. | Example |
sortStart | This event fires immediately after the tablesorter header has been clicked, initializing a resort. | Example |
updateComplete | This event fires after tablesorter has completed updating. (v.2.3.9) | |
Widget Events | ||
filterEnd | Event triggered when the filter widget has finished processing the search (v2.4). | Example |
filterInit | Event triggered when the filter widget has finished initializing (v2.4). | Example |
filterStart | Event triggered when the filter widget has started processing the search (v2.4). | Example |
stickyHeadersInit | Event triggered when the stickyHeader widget has finished initializing (v2.10.4). | |
Pager Events | ||
pageMoved | This event fires when the pager plugin begins to change to the selected page (v2.4.4). | Example |
pagerBeforeInitialized | This event fires after all pager controls have been bound and set up but before the pager formats the table or loads any ajax data (v2.4.4). | |
pagerChange | This event fires when the pager plugin begins to render the table on the currently selected page. (v2.0.7). | Example |
pagerComplete | This event fires when the pager plugin has completed its render of the table on the currently selected page. (v2.0.7). | Example |
pagerInitialized | This event fires when the pager plugin has completed initialization (v2.4.4). | Example |
Variable |
Type |
Description |
Link |
---|---|---|---|
$.tablesorter.language | Object | This object contains the phrases (in English by default) added to the aria-label on each header column. |
|
$.tablesorter.parsers | Array | This is an array of all parser objects added using the addParser function.
|
|
$.tablesorter.themes | Object | This is an object containing a list of specific class names to be applied to table elements. Please see the widget uitheme option for more details. |
|
$.tablesorter.widgets | Array | This is an array of all widget objects added using the addWidget function.
|
|
core | Access the table configuration variables (config ) using any of these methods:
|
||
config.$headers | jQuery Object | Internal list of all table header cells (added v2.8) | |
config.$table | jQuery Object | Internally stored jQuery object of the table (added v2.7.1) | |
config.$tbodies | jQuery Object | Internally stored jQuery object of table non-info block tbodies (added v2.7.1) | |
config.cache | Object | Internal list of table contents (added v2.0.18) | |
config.columns | Number | Internal count of the number of table columns in the header (added v2.12) | |
config.headerContent | Array | Internal list of each header's starting HTML (as text) | |
config.headerList | Array | Internal list of each header element as selected using jQuery selectors in the selectorHeaders option.
|
|
config.parsers | Array | Internal list of all of the table's currently set parsers (objects copied from $.tablesorter.parsers ). Here is a complete list of default parsers:
|
1 2 3 |
hasInitialized | Boolean | Boolean value indicating that tablesorter has been initialized on a table | |
widgets | Access the widgetOptions (wo ) using any of these methods:
|
||
config.$filters | jQuery Object | Only available when the filter widget is active. This variable contains all table cells within the filter row. | |
wo.$sticky | jQuery Object | Only available when the stickyHeaders widget (not the css3 version) is active. | |
wo.filter_$anyMatch | jQuery Object | Only available when the filter widget is active. This variable contains all external search inputs with data-column="all" , bound using the bindSearch function.
|
|
wo.filter_$externalFilters | jQuery Object | Only available when the filter widget is active. This variable contains all external search inputs bound using the bindSearch function.
|
|
wo.filter_initialized | jQuery Object | Only available when the filter widget is active. This variable contains all external search inputs bound using the bindSearch function.
|
Function |
Description |
---|---|
Core Functions | |
addParser | This function allows the adding of custom parser scripts to the tablesorter core. |
addWidget | This function allows the adding of custom widget scripts to the tablesorter core. |
applyWidget | This function applys (refreshes) all currently selected widgets on a table. |
bindEvents | This function adds header event listeners to the targeted cells (New v2.15). |
clearTableBody | This function empties ALL of the table tbodies. |
destroy | This function completely removes tablesorter, including all widgets, associated data & event handlers from the table. |
formatFloat | This function converts a number string into a number type. |
getData | This functions gets the sorter, string, empty, etc options for each column from jQuery data, metadata, header option or header class name ("sorter-false"). |
getParserById | This function returns the named parser object. |
getWidgetById | This function returns the named widget object. |
isDigit | This function determines if a string contains a number after removing commas, periods, quotes and spaces. |
isProcessing | This function adds the processing (indeterminant loading icon) to specific or all header cells while processing table elements. |
isValueInArray | This function returns a zero-based index value of the position of the value within the array, otherwise it returns -1 (Modified Updated v2.15.6). |
processTbody | This function detaches the targeted tbody from the DOM to allow faster manipulation of the tbody contents. |
refreshWidgets | This function removes, then reapplies all currently selected widgets on a table. |
replaceAccents | This function replaces basic accented characters to better sorting & filtering of table contents. |
restoreHeaders | This function restores the table headers cells with their original content. |
showError | This function allows adding/removing a row to the thead, to display any errors New v2.15 |
sortNatural | This function sorts the a & b parameter using a natural sort. |
sortText | This function sorts the a & b parameter using a basic sort. |
Widget Functions | |
addHeaderResizeEvent | Added a resize event to the table headers - used by the stickyHeaders widget, but this is a public function available to any widget (v2.10).
|
bindSearch | This filter widget function allows binding external search filters to the table (v2.13.3; Updated v2.15). |
getFilters | This filter widget function allows getting an array of the currently applied filters (v2.9; Updated v2.15) |
resizableReset | This resizable widget function allows resetting column width changes and clearing out the saved set widths (v2.4; Updated v2.15) |
setFilters | This filter widget function allows setting of the filters; include a true boolean to actually apply the search (v2.9; Updated v2.15):
|
storage | This function allows saving specific table data (especially widgets) to local storage (cookie fallback for no browser support) |
Function |
Description |
---|---|
Core Functions | |
addParser | This function allows the adding of custom parser scripts to the tablesorter core. |
addWidget | This function allows the adding of custom widget scripts to the tablesorter core. |
applyWidget | This function applys (refreshes) all currently selected widgets on a table. |
bindEvents | This function adds header event listeners to the targeted cells (New v2.15). |
clearTableBody | This function empties ALL of the table tbodies. |
destroy | This function completely removes tablesorter, including all widgets, associated data & event handlers from the table. |
formatFloat | This function converts a number string into a number type. |
getData | This functions gets the sorter, string, empty, etc options for each column from jQuery data, metadata, header option or header class name ("sorter-false"). |
getParserById | This function returns the named parser object. |
getWidgetById | This function returns the named widget object. |
isDigit | This function determines if a string contains a number after removing commas, periods, quotes and spaces. |
isProcessing | This function adds the processing (indeterminant loading icon) to specific or all header cells while processing table elements. |
isValueInArray | This function returns a zero-based index value of the position of the value within the array, otherwise it returns -1 (Modified Updated v2.15.6). |
processTbody | This function detaches the targeted tbody from the DOM to allow faster manipulation of the tbody contents. |
refreshWidgets | This function removes, then reapplies all currently selected widgets on a table. |
replaceAccents | This function replaces basic accented characters to better sorting & filtering of table contents. |
restoreHeaders | This function restores the table headers cells with their original content. |
showError | This function allows adding/removing a row to the thead, to display any errors New v2.15 |
sortNatural | This function sorts the a & b parameter using a natural sort. |
sortText | This function sorts the a & b parameter using a basic sort. |
Widget Functions | |
addHeaderResizeEvent | Added a resize event to the table headers - used by the stickyHeaders widget, but this is a public function available to any widget (v2.10).
|
bindSearch | This filter widget function allows binding external search filters to the table (v2.13.3; Updated v2.15). |
getFilters | This filter widget function allows getting an array of the currently applied filters (v2.9; Updated v2.15) |
resizableReset | This resizable widget function allows resetting column width changes and clearing out the saved set widths (v2.4; Updated v2.15) |
setFilters | This filter widget function allows setting of the filters; include a true boolean to actually apply the search (v2.9; Updated v2.15):
|
storage | This function allows saving specific table data (especially widgets) to local storage (cookie fallback for no browser support) |
Full release - Plugin, Documentation, Add-ons, Themes. Download: zip or tar.gz
Pick n choose - Place at least the required files in a directory on your webserver that is accessible to a web browser. Record this location.
Required:Theme zip files have been removed. There are now numerous themes available which can be seen here.
tablesorter has been tested successfully in the following browsers with Javascript enabled:
First, please review the FAQ page to see if it will help you resolve the problem.
If you are having a problem with the plugin or you want to submit a feature request, please submit an issue.
Support is also available from stackoverflow.
If you would like to contribute, fork a copy on github.
Some basic unit testing has been added (v2.6). If you would like to add more or report a problem, please use the appropriate link above.
For questions about jQuery, try irc, stackoverflow, or the jQuery forums.
Written by Christian Bach.
Documentation written by Brian Ghidinelli, based on Mike Alsup's great documention.
Additional & Missing documentation, alphanumeric sort, numerous widgets, unit testing and other changes added by Mottie.
Thanks to all that have contributed code, comments, feedback and everything else. A special thanks goes out to:
John Resig for the fantastic jQuery