Skip to content
Browse files

Added emptyToBottom option

  • Loading branch information...
1 parent b612f24 commit 566315ad1f4075b3a26d78571fc5932dca8f9013 @Mottie committed Apr 12, 2012
View
232 README.markdown
@@ -1,38 +1,46 @@
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.
-See the [full documentation](http://mottie.github.com/tablesorter/docs/)
+### Documentation
-###Demos
+* See the [full documentation](http://mottie.github.com/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).
-* [Basic alpha-numeric sort Demo](http://mottie.github.com/tablesorter/)
-* More demos can be found in the [documentation](http://mottie.github.com/tablesorter/docs/)
-* Demos & playgrounds - updated in the [wiki pages](https://github.com/Mottie/tablesorter/wiki).
+### Demos
-###Features
+* [Basic alpha-numeric sort Demo](http://mottie.github.com/tablesorter/).
+* Links to demo pages can be found within the main [documentation](http://mottie.github.com/tablesorter/docs/).
+* More demos & playgrounds - updated in the [wiki pages](https://github.com/Mottie/tablesorter/wiki).
+
+### Features
* Multi-column sorting.
-* 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.com/tablesorter/docs/example-parsers.html)
+* 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.com/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.com/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+
-###Documentation
+### Licensing
-Included all original [document pages](http://mottie.github.com/tablesorter/docs/index.html) with updates from my blog post on [undocumented options](http://wowmotty.blogspot.com/2011/06/jquery-tablesorter-missing-docs.html).
+* 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.
-###Licensing
+### Change Log
-* 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:
+View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change).
-###Change Log
+#### Version 2.1.11 (4/12/2012)
-View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt).
+* Added `emptyToBottom` option which tells tablesorter how you want it to sort empty table cells. Enhancement from [issue #]().
+ * `true` - sort empty table cells to the bottom.
+ * `false` - sort empty table cells to the top.
+ * `null` - sort empty table cells as if the cell has the lowest value (less than "a" and "0").
#### Version 2.1.10 (4/2/2012)
@@ -64,197 +72,3 @@ View the [complete listing here](http://mottie.github.com/tablesorter/changelog.
* Reverted the "filter" widget code to work like it is supposed to. Fix for [issue #40](https://github.com/Mottie/tablesorter/issues/40).
* Modified the "stickHeaders" widget to now set the width of the content instead of the table cell. It seems to work better. Fix for [issue #37](https://github.com/Mottie/tablesorter/issues/37)
* Fixed the "uitheme" widget code to update the sorting icon correctly.
-
-#### Version 2.1.6 (3/22/2012)
-
-* Pager updates
- * Updated pager css. It wasn't targeting the pager block correctly.
- * Moved pager into the thead and/or tfoot in the <a href="example-pager-ajax.html">pager ajax demo</a>.
- * The pager plugin ajax method should now only target the header column text (not the pager) and first footer row when updating the header text.
-* Sticky Header widget &amp table css updated:
- * Modified styles to add a border instead of using the row background; `border-spacing` css set to zero.
- * Sticky header right edge should now align with the table.
- * Removed top margin from IE so it will stick to the top of the browser window.
-* Removed `setTimeout` functions. More details on why they were removed are [described here](http://wowmotty.blogspot.com/2011/06/jquery-tablesorter-missing-docs.html?showComment=1331768792441#c2353159245237432035).
-
-#### Version 2.1.5 (3/20/2012)
-
-* The `isoDate` parser should now allow sorting of empty cells at the bottom. Fix for [issue #38](https://github.com/Mottie/tablesorter/issues/38).
-
-#### Version 2.1.4 (3/18/2012)
-
-* Modified widget scripts to not cause errors when older versions of jQuery are loaded.
-* Updated widget demos to include notes on minimum required jQuery verison.
-* Added `$.tablesorter.version` function which returns the current version number.
-
-#### Version 2.1.3.1 (3/17/2012)
-
-* Merged in bug fixes contributed by [Rozwell](https://github.com/rozwell). Thanks!
-* Updated pager minified version, along with version numbers.
-
-#### Version 2.1.3 (3/12/2012)
-
-* Added `usNumberFormat` option.
- * Set to `true` for U.S. number format: `1,234,567.89`
- * Set to `false` for German `1.234.567,89` or French `1 234 567,89` formats.'
- * Fix for [issue #34](https://github.com/Mottie/tablesorter/issues/34) and [issue # 31](https://github.com/Mottie/tablesorter/issues/31#issuecomment-4236945).
-* Changed pager plugin ajax functions & demo
- * The `ajaxProcessing` function now must now return two or three pieces of information: [ total, rows, headers ]
- * `total` is the total number of rows in the database.
- * `rows` is an array of table rows with an array of table cells in each row.
- * `headers` is an array of header cell text (optional).
-
- ```javascript
- // process ajax so that the following information is returned:
- // [ total_rows (number), rows (array of arrays), headers (array; optional) ]
- // example:
- [
- // total # rows contained in the database
- 100,
- // row data: array of arrays; each internal array has the table data
- [
- [ "row1cell1", "row1cell2", ... "row1cellN" ],
- [ "row2cell1", "row2cell2", ... "row2cellN" ],
- ...
- [ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
- ],
- // header text (optional)
- [ "Header1", "Header2", ... "HeaderN" ]
- ]
- ```
-
- * Modified pager plugin ajax demo to hopefully make the data processing a bit more clear by changing `data` inside of the City#.json files to `rows`.
- * The demo json data should now render the unicode characters properly. Switched the files to the proper utf-8 encoding.
- * When no data is returned, the table will now:
- * Insert a row into the header showing the ajax error. If a row is inserted into the tbody, clicking on the header would cause a parser error.
- * Disable the pager so the pager counter won't show zero total rows.
- * Fix for issue dicussed within [issue #31](https://github.com/Mottie/tablesorter/issues/31#issuecomment-4390379).
-
-#### Version 2.1.2 (3/11/2012)
-
-* Added `table` and `cellIndex` variables to the `textExtraction` function to allow using a more general function for text extraction.
-* Empty cells will no longer skip the parser allowing extracting data attributes.
- * This was only an issue on table cells with no text.
- * Added a demo to the [demos wiki page](https://github.com/Mottie/tablesorter/wiki) whichs allows [dynamic sorting of checkboxes](http://jsfiddle.net/Mottie/vCTHw/18/).
-
-#### Version 2.1.1 (3/8/2012)
-
-* Renamed `filter_fromStart` to `filter_startsWith`.
-* Fixed an issue with `sortRestart` not working properly.
- * In turn, `sortReset`, `lockOrder` and `sortInitialOrder` were modified with this change and were made sure to all work properly.
- * The `sortInitialOrder` will work in either the main options or specifically within the headers option when a particular column needs a different initial sort order.
- * Added a [sortReset/sortRestart](http://mottie.github.com/tablesorter/docs/example-option-sortreset-sortrestart.html) demo.
- * Resolves [issue #30](https://github.com/Mottie/tablesorter/issues/29).
-* Updated pager plugin to better work with the sticky header widget.
-
-#### Version 2.1 (3/7/2012)
-
-* Added `selectorRemove` option
- * Any table row with this css class will be removed from the table prior to updating the table contents.
- * The reason this was added was in case a widget or some other script adds rows to the table for styling, or something else. If a table update is triggered (`$(table).trigger('update');`), all rows in the table will be included in the update.
- * The [writing custom widgets](http://mottie.github.com/tablesorter/docs/example-widgets.html) demo has been updated to include this class name.
- * The pager plugin update also uses this to remove the row added by the new `fixedHeight` option.
- * It's default value is `tr.remove-me`, so it can be modified to remove more than just rows.
-
-* Fixed a bug that broke the plugin if you set `sorter: true` in the header options.
-
-* Pager plugin update
- * Ajax
- * The pager plugin will now interact with a database via JSON. See [demo here](http://mottie.github.com/tablesorter/docs/example-pager-ajax.html).
- * Added `ajaxUrl` option which contains the variables `{page}` and `{size}` which will be replaced by the plugin to obtain that data.
-
- ```javascript
- ajaxUrl : "http:/mydatabase.com?page={page}&size={size}"
- ```
-
- * Another option named `ajaxProcessing` was included to process the data before returning it to the pager plugin. Basically the JSON needs to contain the data to match the example below. An additional required variable is the total number of records or rows needs to be returned.
-
- ```javascript
- // process ajax so that the data object is returned along with the total number of rows
- // example: { "data" : [{ "ID": 1, "Name": "Foo", "Last": "Bar" }], "total_rows" : 100 }
- ajaxProcessing: function(ajax){
- if (ajax && ajax.hasOwnProperty('data')) {
- // return [ "data", "total_rows" ];
- return [ ajax.data, ajax.total_rows ];
- }
- }
- ```
-
- * I tried to make the plugin interact with a database as flexible as possible, but I'm sure I haven't covered every situation. So any and all feedback is welcome!
- * Also, much thanks to [kachar](https://github.com/kachar) for the [enhancement request](https://github.com/Mottie/tablesorter/issues/31) and willingness to help test it!
-
- * Removed `positionFixed` and `offset` options.
- * Added `fixedHeight` option which replaces the `positionFixed` and `offset` options by maintaining the height of the table no matter how few rows are showing. During testing, it displayed some odd behaviour after adding or deleting rows, but it should have been fixed... just please keep an eye out ;).
- * The pager now adds all of its options to the table configuration options within an object named "pager". Basically what this means is that instead of add all of the pager options to be mixed in with the tablesorter options, the pager options have been isolated and can be found by typing this into the browser console: `$('table')[0].config.pager`.
-
-* **Storage** function added named `$.tablesorter.storage` for use in widgets
- * It is used by various widgets to save data to either local storage (if available) or cookies.
- * This function needs to use `JSON.stringify()` which is [not supported by IE7](http://caniuse.com/#search=json). If you need to support IE7, then include this library: [JSON-js](https://github.com/douglascrockford/JSON-js).
- * Use the function with your own custom widgets as follows:
-
- ```javascript
- // *** Save data (JSON format only) ***
- // val must be valid JSON... use http://jsonlint.com/ to ensure it is valid
- var val = { "mywidget" : "data1" }; // valid JSON uses double quotes
- // $.tablesorter.storage(table, key, val);
- $.tablesorter.storage(table, 'tablesorter-mywidget', val);
-
- // *** Get data: $.tablesorter.storage(table, key); ***
- v = $.tablesorter.storage(table, 'tablesorter-mywidget');
- // val may be empty, so also check for your data
- val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
- alert(val); // "data1" if saved, or "" if not
- ```
-
-* Added an option named `widgetOptions`:
- * 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.
- * Only one widget option, `widgetZebra` will be retained for backwards compatibility with the original plugin.
- * More details for each widget are explained below.
-
-* **Zebra** widget:
- * Added `zebra` options to the new `widgetOptions`.
-
- ```javascript
- widgetOptions : {
- zebra : [ "even", "odd" ]
- }
- ```
-
- * This replaces `widgetZebra: { css: [ "even", "odd" ] }`, but if the `widgetZebra` option exists, it will over-ride this newer `widgetOptions.zebra` option in order to maintain backwards compatibility.
-
-* **UI Theme** widget:
- * Changed css class of div wrapping the contents of each header cell from "inner" to "tablesorter-inner".
- * Added "ui-state-default" to the table head columns. Thanks to [Raigen](https://github.com/Raigen) for [sharing the code](https://github.com/Mottie/tablesorter/pull/33)!
- * Moved `widgetUitheme` option into the new `widgetOptions`.
-
- ```javascript
- widgetOptions : {
- // adding zebra striping, using content and default styles - the ui css removes the background from default
- // even and odd class names included for this demo to allow switching themes
- zebra : ["ui-widget-content even", "ui-state-default odd"],
-
- // change default uitheme icons - find the full list of icons here: http://jqueryui.com/themeroller/ (hover over them for their name)
- // default icons: ["ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n"]
- // ["up/down arrow (cssHeaders/unsorted)", "down arrow (cssDesc/descending)", "up arrow (cssAsc/ascending)" ]
- uitheme : ["ui-icon-carat-2-n-s", "ui-icon-carat-1-s", "ui-icon-carat-1-n"]
- }
- ```
-
-* **Filter** widget changes:
- * Added a new filter widget specific option `widgetOptions.filter_fromStart` which makes the filter only work from the first letter.
- * Added a `widgetOptions.filter_cssFilter` option which now contains the class name added to the filter row and each input within it. Previously the class name used was "filters" for the row and "filter" for the input, now both are "tablesorter-filter". Thanks to [cr125rider](https://github.com/cr125rider) for [sharing a code fix](https://github.com/Mottie/tablesorter/issues/32)!
- * Added css3 box sizing to allow a better fitting filter box. Thanks to [thezoggy](https://github.com/thezoggy) for sharing the code!
- * The css changes were also added to the blue, green and UI style sheets.
- * Updated the filter widget demo with the available options described above; this includes the `widgetOptions.filter_childRows` option which was previously undocumented, recently renamed.
-
-* **Resizable Columns** Widget changes:
- * The resized column width is now saved using the `$.tablesorter.storage()` function (optional)
- * If the storage function doesn't exist, the widget will still function, but just not save the column width.
-
-* **Save Sort** Widget changes:
- * Modified to now use the `$.tablesorter.storage()` function (required)
- * The storage function is required for this widget to work properly.
- * Previous saved data is not compatible with the changes made and will be ignored.
-
-* Updated all docs demos to use jQuery 1.7+.
View
669 changelog.txt
@@ -1,667 +1,2 @@
-TableSorter Change Log
-
-Version 2.1.10 (4/2/2012)
-============================
-
-* Widget data should now save multiple tables on a single page properly. Fix for [issue #41](https://github.com/Mottie/tablesorter/issues/41).
-
-Version 2.1.9 (3/31/2012)
-============================
-
-* Empty cells in a numerical column should now sort properly.
-* Setting an initial `sortList` should now set the header sort correctly; so, clicking on the header will properly change the sort direction. Fix for [issue #43](https://github.com/Mottie/tablesorter/issues/43).
-
-Version 2.1.8 (3/27/2012)
-============================
-
-* Modified blue &amp; green themes by lowering css specificity. The arrows weren't being applied to the header.
-* Updated Sticky Header widget demo page to include a tablesorter theme switcher.
-
-Version 2.1.7 (3/26/2012)
-============================
-
-* Changed default css options to use more unique names:
- * `cssHeader` is now `"tablesorter-header"`
- * `cssAsc` is now `"tablesorter-headerSortUp"`
- * `cssDesc` is now `"tablesorter-headerSortDown"`
- * Updated blue &amp; green styles to use the appropriate names.
- * Left the original css definitions to keep the styles backward compatible.
-* Table header cell content wrapper modification:
- * Previously the content was wrapped with a `span`, now wrapped with a `div`
- * Content wrapping div now as the class name of `tablesorter-header-inner` applied to it.
-* Various widget fixes:
- * The `$.tablesorter.storage` code now loads saved variables before updating. Fix for [issue #41](https://github.com/Mottie/tablesorter/issues/41).
- * Reverted the "filter" widget code to work like it is supposed to. Fix for [issue #40](https://github.com/Mottie/tablesorter/issues/40).
- * Modified the "stickHeaders" widget to now set the width of the content instead of the table cell. It seems to work better. Fix for [issue #37](https://github.com/Mottie/tablesorter/issues/37)
- * Fixed the "uitheme" widget code to update the sorting icon correctly.
-
-Version 2.1.6 (3/22/2012)
-============================
-
-* Pager updates
- * Updated pager css. It wasn't targeting the pager block correctly.
- * Moved pager into the thead and/or tfoot in the <a href="example-pager-ajax.html">pager ajax demo</a>.
- * The pager plugin ajax method should now only target the header column text (not the pager) and first footer row when updating the header text.
-* Sticky Header widget &amp table css updated:
- * Modified styles to add a border instead of using the row background; `border-spacing` css set to zero.
- * Sticky header right edge should now align with the table.
- * Removed top margin from IE so it will stick to the top of the browser window.
-* Removed `setTimeout` functions. More details on why they were removed are [described here](http://wowmotty.blogspot.com/2011/06/jquery-tablesorter-missing-docs.html?showComment=1331768792441#c2353159245237432035).
-
-Version 2.1.5 (3/20/2012)
-============================
-
-* The `isoDate` parser should now allow sorting of empty cells at the bottom. Fix for [issue #38](https://github.com/Mottie/tablesorter/issues/38).
-
-Version 2.1.4 (3/18/2012)
-============================
-
-* Modified widget scripts to not cause errors when older versions of jQuery are loaded.
-* Updated widget demos to include notes on minimum required jQuery verison.
-* Added `$.tablesorter.version` function which returns the current version number.
-
-Version 2.1.3.1 (3/17/2012)
-============================
-
-* Merged in bug fixes contributed by [Rozwell](https://github.com/rozwell). Thanks!
-* Updated pager minified version, along with version numbers.
-
-Version 2.1.3 (3/12/2012)
-============================
-
-* Added `usNumberFormat` option.
- * Set to `true` for U.S. number format: `1,234,567.89`
- * Set to `false` for German `1.234.567,89` or French `1 234 567,89` formats.'
- * Fix for [issue #34](https://github.com/Mottie/tablesorter/issues/34) and [issue # 31](https://github.com/Mottie/tablesorter/issues/31#issuecomment-4236945).
-* Changed pager plugin ajax functions & demo
- * The `ajaxProcessing` function now must now return two or three pieces of information: [ total, rows, headers ]
- * `total` is the total number of rows in the database.
- * `rows` is an array of table rows with an array of table cells in each row.
- * `headers` is an array of header cell text (optional).
-
- ```javascript
- // process ajax so that the following information is returned:
- // [ total_rows (number), rows (array of arrays), headers (array; optional) ]
- // example:
- [
- // total # rows contained in the database
- 100,
- // row data: array of arrays; each internal array has the table data
- [
- [ "row1cell1", "row1cell2", ... "row1cellN" ],
- [ "row2cell1", "row2cell2", ... "row2cellN" ],
- ...
- [ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
- ],
- // header text (optional)
- [ "Header1", "Header2", ... "HeaderN" ]
- ]
- ```
-
- * Modified pager plugin ajax demo to hopefully make the data processing a bit more clear by changing `data` inside of the City#.json files to `rows`.
- * The demo json data should now render the unicode characters properly. Switched the files to the proper utf-8 encoding.
- * When no data is returned, the table will now:
- * Insert a row into the header showing the ajax error. If a row is inserted into the tbody, clicking on the header would cause a parser error.
- * Disable the pager so the pager counter won't show zero total rows.
- * Fix for issue dicussed within [issue #31](https://github.com/Mottie/tablesorter/issues/31#issuecomment-4390379).
-
-Version 2.1.2 (3/11/2012)
-============================
-
-* Added `table` and `cellIndex` variables to the `textExtraction` function to allow using a more general function for text extraction.
-* Empty cells will no longer skip the parser allowing extracting data attributes.
- * This was only an issue on table cells with no text.
- * Added a demo to the [demos wiki page](https://github.com/Mottie/tablesorter/wiki) whichs allows [dynamic sorting of checkboxes](http://jsfiddle.net/Mottie/vCTHw/18/).
-
-Version 2.1.1 (3/8/2012)
-============================
-
-* Renamed `filter_fromStart` to `filter_startsWith`.
-* Fixed an issue with `sortRestart` not working properly.
- * In turn, `sortReset`, `lockOrder` and `sortInitialOrder` were modified with this change and were made sure to all work properly.
- * The `sortInitialOrder` will work in either the main options or specifically within the headers option when a particular column needs a different initial sort order.
- * Added a [sortReset/sortRestart](http://mottie.github.com/tablesorter/docs/example-option-sortreset-sortrestart.html) demo.
- * Resolves [issue #30](https://github.com/Mottie/tablesorter/issues/29).
-* Updated pager plugin to better work with the sticky header widget.
-
-Version 2.1 (3/7/2012)
-============================
-
-* Added `selectorRemove` option
- * Any table row with this css class will be removed from the table prior to updating the table contents.
- * The reason this was added was in case a widget or some other script adds rows to the table for styling, or something else. If a table update is triggered (`$(table).trigger('update');`), all rows in the table will be included in the update.
- * The [writing custom widgets](http://mottie.github.com/tablesorter/docs/example-widgets.html) demo has been updated to include this class name.
- * The pager plugin update also uses this to remove the row added by the new `fixedHeight` option.
- * It's default value is `tr.remove-me`, so it can be modified to remove more than just rows.
-
-* Fixed a bug that broke the plugin if you set `sorter: true` in the header options.
-
-* Pager plugin update
- * Ajax
- * The pager plugin will now interact with a database via JSON. See [demo here](http://mottie.github.com/tablesorter/docs/example-pager-ajax.html).
- * Added `ajaxUrl` option which contains the variables `{page}` and `{size}` which will be replaced by the plugin to obtain that data.
-
- ```javascript
- ajaxUrl : "http:/mydatabase.com?page={page}&size={size}"
- ```
-
- * Another option named `ajaxProcessing` was included to process the data before returning it to the pager plugin. Basically the JSON needs to contain the data to match the example below. An additional required variable is the total number of records or rows needs to be returned.
-
- ```javascript
- // process ajax so that the data object is returned along with the total number of rows
- // example: { "data" : [{ "ID": 1, "Name": "Foo", "Last": "Bar" }], "total_rows" : 100 }
- ajaxProcessing: function(ajax){
- if (ajax && ajax.hasOwnProperty('data')) {
- // return [ "data", "total_rows" ];
- return [ ajax.data, ajax.total_rows ];
- }
- }
- ```
-
- * I tried to make the plugin interact with a database as flexible as possible, but I'm sure I haven't covered every situation. So any and all feedback is welcome!
- * Also, much thanks to [kachar](https://github.com/kachar) for the [enhancement request](https://github.com/Mottie/tablesorter/issues/31) and willingness to help test it!
-
- * Removed `positionFixed` and `offset` options.
- * Added `fixedHeight` option which replaces the `positionFixed` and `offset` options by maintaining the height of the table no matter how few rows are showing. During testing, it displayed some odd behaviour after adding or deleting rows, but it should have been fixed... just please keep an eye out ;).
- * The pager now adds all of its options to the table configuration options within an object named "pager". Basically what this means is that instead of add all of the pager options to be mixed in with the tablesorter options, the pager options have been isolated and can be found by typing this into the browser console: `$('table')[0].config.pager`.
-
-* **Storage** function added named `$.tablesorter.storage` for use in widgets
- * It is used by various widgets to save data to either local storage (if available) or cookies.
- * This function needs to use `JSON.stringify()` which is [not supported by IE7](http://caniuse.com/#search=json). If you need to support IE7, then include this library: [JSON-js](https://github.com/douglascrockford/JSON-js).
- * Use the function with your own custom widgets as follows:
-
- ```javascript
- // *** Save data (JSON format only) ***
- // val must be valid JSON... use http://jsonlint.com/ to ensure it is valid
- var val = { "mywidget" : "data1" }; // valid JSON uses double quotes
- // $.tablesorter.storage(table, key, val);
- $.tablesorter.storage(table, 'tablesorter-mywidget', val);
-
- // *** Get data: $.tablesorter.storage(table, key); ***
- v = $.tablesorter.storage(table, 'tablesorter-mywidget');
- // val may be empty, so also check for your data
- val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
- alert(val); // "data1" if saved, or "" if not
- ```
-
-* Added an option named `widgetOptions`:
- * 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.
- * Only one widget option, `widgetZebra` will be retained for backwards compatibility with the original plugin.
- * More details for each widget are explained below.
-
-* **Zebra** widget:
- * Added `zebra` options to the new `widgetOptions`.
-
- ```javascript
- widgetOptions : {
- zebra : [ "even", "odd" ]
- }
- ```
-
- * This replaces `widgetZebra: { css: [ "even", "odd" ] }`, but if the `widgetZebra` option exists, it will over-ride this newer `widgetOptions.zebra` option in order to maintain backwards compatibility.
-
-* **UI Theme** widget:
- * Changed css class of div wrapping the contents of each header cell from "inner" to "tablesorter-inner".
- * Added "ui-state-default" to the table head columns. Thanks to [Raigen](https://github.com/Raigen) for [sharing the code](https://github.com/Mottie/tablesorter/pull/33)!
- * Moved `widgetUitheme` option into the new `widgetOptions`.
-
- ```javascript
- widgetOptions : {
- // adding zebra striping, using content and default styles - the ui css removes the background from default
- // even and odd class names included for this demo to allow switching themes
- zebra : ["ui-widget-content even", "ui-state-default odd"],
-
- // change default uitheme icons - find the full list of icons here: http://jqueryui.com/themeroller/ (hover over them for their name)
- // default icons: ["ui-icon-arrowthick-2-n-s", "ui-icon-arrowthick-1-s", "ui-icon-arrowthick-1-n"]
- // ["up/down arrow (cssHeaders/unsorted)", "down arrow (cssDesc/descending)", "up arrow (cssAsc/ascending)" ]
- uitheme : ["ui-icon-carat-2-n-s", "ui-icon-carat-1-s", "ui-icon-carat-1-n"]
- }
- ```
-
-* **Filter** widget changes:
- * Added a new filter widget specific option `widgetOptions.filter_fromStart` which makes the filter only work from the first letter.
- * Added a `widgetOptions.filter_cssFilter` option which now contains the class name added to the filter row and each input within it. Previously the class name used was "filters" for the row and "filter" for the input, now both are "tablesorter-filter". Thanks to [cr125rider](https://github.com/cr125rider) for [sharing a code fix](https://github.com/Mottie/tablesorter/issues/32)!
- * Added css3 box sizing to allow a better fitting filter box. Thanks to [thezoggy](https://github.com/thezoggy) for sharing the code!
- * The css changes were also added to the blue, green and UI style sheets.
- * Updated the filter widget demo with the available options described above; this includes the `widgetOptions.filter_childRows` option which was previously undocumented, recently renamed.
-
-* **Resizable Columns** Widget changes:
- * The resized column width is now saved using the `$.tablesorter.storage()` function (optional)
- * If the storage function doesn't exist, the widget will still function, but just not save the column width.
-
-* **Save Sort** Widget changes:
- * Modified to now use the `$.tablesorter.storage()` function (required)
- * The storage function is required for this widget to work properly.
- * Previous saved data is not compatible with the changes made and will be ignored.
-
-* Updated all docs demos to use jQuery 1.7+.
-
-Version 2.0.31 (2012-2-27)
-============================
-
-* Added `sortRestart` option:
- * When `true`, this option resets the sort direction so that clicking on an unsorted column will now sort in the `sortInitialOrder` direction.
- * Clicking on a single column to cancel a multi-sorted table may not initially sort as expected.
- * Requested by severa in [issue #30](https://github.com/Mottie/tablesorter/issues/29). Thanks!
-* Made some `sortReset` fixes:
- * Columns widget will now clear it's styling when the sort has reset.
- * Added a [demo](http://mottie.github.com/tablesorter/).
-* Changed the filter widget inputs to be of a search type:
- * Currently only supported by webkit.
- * Requested by cr125rider in [issue #29](https://github.com/Mottie/tablesorter/issues/29). Thanks!
-* Updated `sortLocaleCompare` documentation since it was explained incorrectly.
-* Did some general code cleanup and some optimization.
-
-Version 2.0.30.1 (2012-2-20)
-============================
-
-* Modified the "filter" widget to disable the input window instead of setting it with display none. Now the input is disabled and a "disabled" class is applied to allow for further styling.
-
-Version 2.0.30 (2012-2-20)
-============================
-
-* Fixed the total mess I just made with the addWidget init functionality... I need a vacation :P
-
-Version 2.0.29 (2012-2-20)
-============================
-
-* Fixed a problem with the addWidget init function which apparently was always being called, even if you didn't want it! Fix for [issue #28](https://github.com/Mottie/tablesorter/issues/28). Thanks to thezoggy for helping with troubleshooting!
-* Minor cleanup of sorting class names code.
-
-Version 2.0.28.1 (2012-2-16)
-============================
-
-* Modified the plugin pager to ignore child rows. Fix for [issue #27](https://github.com/Mottie/tablesorter/issues/27).
-
-Version 2.0.28 (2012-2-1)
-============================
-
-* Added a new function to widgets called "init" which is called upon initialization, before any of the widgets are applied.
- * I added it to allow the "saveSort" widget to get the saved sort data (localStorage or cookie) before the initial sort was applied.
- * The "saveSort" widget is still compatible with the original tablesorter, but the original version will call all of the widgets twice on initialization, if using the "saveSort" widget.
- * New add widget format is as follows:
-
- ```javascript
- $.tablesorter.addWidget({
- id: 'myWidget',
- init: function(table, allWidgets, thisWidget){
- // widget initialization code - this is only run ONCE
- // but in this example I call the format function because
- // I want to keep it backwards compatible with the original tablesorter
- thisWidget.format(table, true);
- },
- format: function(table, initFlag) {
- // widget code to apply to the table AFTER EACH SORT
- // the initFlag is true when format is called for the first time, but
- // only if it is called from the init function
- }
- });
- ```
-
-Version 2.0.27 (2012-1-31)
-============================
-
-* Added `sortReset` option
- * Setting this option to `true`, allows you to click on the header a third time to clear the sort
- * Clearing the sort DOES NOT return the table to it's initial unsorted state.
-* Added `saveSort` widget
- * This widget will save the last sort to local storage, and will fallback to cookies.
- * The widget does use the `JSON.stringify` function which is [not fully supported](http://caniuse.com/#search=json) (IE7), so if you plan to support it and use this widget, please include this [JSON library](https://github.com/douglascrockford/JSON-js).
-* Fixed pager page size not sticking. Fix for [issue #24](https://github.com/Mottie/tablesorter/issues/24).
-
-Version 2.0.26 (2012-1-30)
-============================
-
-* Widgets should no longer be applied twice when an initial sort direction is added. Fix for [issue #21](https://github.com/Mottie/tablesorter/issues/21).
-* Modified Green theme:
- * The Green theme sort direction icon is now applied to only the first span it encounters inside the header. The UI theme adds a second span for it's icon.
- * Essentially to fix [this demo](http://mottie.github.com/tablesorter/docs/example-widget-ui-theme.html) which allows switching between all of the themes.
-* Modified the UI theme to now add a div that wraps all of the header cell content to allow positioning of the sort direction icon.
-
-Version 2.0.25.2 (2012-1-27)
-============================
-
-* Changed Blue theme to vertically align arrows. Fix for [issue #12](https://github.com/Mottie/tablesorter/issues/12).
-* Fixed sticky header widget so varing width columns now update when the pager plugin changes pages. Thanks to locationRoura for reporting this issue.
-
-Version 2.0.25.1 (2011-12-15)
-============================
-
-* Fixed disabled column style for the ui theme widget. Thanks to [bbbco](https://github.com/bbbco) for the fix in [issue #17](https://github.com/Mottie/tablesorter/issues/17).
-
-
-Version 2.0.25 (2011-12-14)
-============================
-
-* The ui theme and sticky header widgets now work together and update the arrow direction. Fix for [issue #15](https://github.com/Mottie/tablesorter/issues/15).
-* Empty cells with only a tab or space will now sort at the bottom. Thanks to [pursual](https://github.com/pursual) for the fix for [issue #16](https://github.com/Mottie/tablesorter/issues/16).
-
-Version 2.0.24 (2011-12-12)
-============================
-
-* Modified empty cell sorting to always sort at the bottom. Fix for [issue #14](https://github.com/Mottie/tablesorter/issues/14).
-* Updated the sticky header widget to line up properly with the UI theme. Fix for [issue #13](https://github.com/Mottie/tablesorter/issues/13).
-
-Version 2.0.23.5 (2011-12-6)
-============================
-
-* Updated the sticky header widget again to not interfere with the filter widget. Fix for [issue #10](https://github.com/Mottie/tablesorter/issues/10).
-
-Version 2.0.23.4 (2011-12-6)
-============================
-
-* Updated the sticky header widget to reposition the sticky header when scrolling left. Fix for [issue #9](https://github.com/Mottie/tablesorter/issues/9).
-
-Version 2.0.23.3 (2011-11-7)
-============================
-
-* Updated the filter widget:
- * Changed filter input from visibility hidden to display none. Fix/enhancement from [issue #7](https://github.com/Mottie/tablesorter/issues/7).
- * Modified the widget to better work with child rows. Added the `widgetFilterChildRows` option. Fix for [issue #8](https://github.com/Mottie/tablesorter/issues/8).
- * When `widgetFilterChildRows` is true, all child row content is included in the row filtering; if false, the child row content is ignored.
-* Added `tableClass` to the documents. Apparently I forgot to add it before.
-* Added a note to the filter demo bringing up [issue #6](https://github.com/Mottie/tablesorter/issues/6).
-* Miscellaneous updates to the documents.
-
-Version 2.0.23.2 (2011-10-28)
-============================
-
-* Fixed pager size & total pages not being retained after destroying, then restoring the pager. Thanks to crush123 for reporting the problem!
-
-Version 2.0.23.1 (2011-10-26)
-============================
-
-* Fixed the pager plugin to prevent errors when initialized on an empty table. Fix for [issue #5](https://github.com/Mottie/tablesorter/issues/5).
-* Added a Resizable Column widget
- * At this time, this widget allows resizing the column widths from the header.
- * The column widths are not saved, but if I did consider saving the widths to local storage. I just didn't get around to doing it.
- * [Demo page](http://mottie.github.com/tablesorter/docs/example-widget-resizable.html) added.
-* Reorganized the next demo links, located at the bottom of every demo page, to match the order on the main document page.
-
-Version 2.0.23 (2011-10-18)
-============================
-
-* Changed the `dateFormat` option:
- * The settings are now "mmddyyyy", "ddmmyyyy", and "yyyymmdd".
- * Changed the date separator to include any of the following: slash, dash, period, comma, space(s) or tab.
- * The date format parser will only work with a four digit year.
- * Added a [demo page](http://mottie.github.com/tablesorter/docs/example-option-date-format.html).
-
-Version 2.0.22.1 (2011-10-15)
-============================
-
-* Updated the stickyHeaders widget
- * Sticky headers will now resize with the browser window
- * Updated blue and green themes to work better with sticky headers.
- * If using the uitheme widget, make sure the 'uitheme' widget is applied before (left of) the 'stickyHeaders' widget, as follows:
-
- widgets: ['zebra', 'uitheme', 'stickyHeaders']
-
-Version 2.0.22 (2011-10-13)
-============================
-
-* Updated the pager plugin:
- * Fixed a problem that occurred when `removeRows` is set to false - fix for [issue #4](https://github.com/Mottie/tablesorter/issues/4).
- * Added "disable.pager" and "enable.pager" methods to the pager. These are useful if you want to delete a table row with the pager applied.
-
- // Delete a row
- // this function targets a button with a "remove" class name inside a table row
- // *************
- // Use delegate or live because `removeRows` is set to `true` in the demo - hidden rows don't exist
- $('table').delegate('button.remove', 'click' ,function(){
- var t = $('table');
- // disabling the pager will restore all table rows
- t.trigger('disable.pager');
- // remove the chosen row
- $(this).closest('tr').remove();
- // restore pager
- t.trigger('enable.pager');
- });
-
- * Fixed the `positionFixed` option (which positions the pager below the table) to now include the `offset` option value.
- * Fixed the pager arrow buttons so that destroying and enabling the pager multiple times doesn't multiply the number of pages changed.
- * Updated the pager demo page to allow deleting rows.
- * General cleanup and added lots of comments in the plugin and demo page on what each pager option does.
-* Made one minor change to the tablesorter plugin to accomidate the pager plugin using the `removeRows` option.
-
-Version 2.0.21.1 (2011-10-11)
-============================
-
-* Added "stickyHeader" widget to the "jquery.tablesorter.widgets.js" file.
- * This widget makes the header stick to the top of the page while scrolling down.
- * The sticky header is fully functional and will allow you to sort the table.
- * And best of all, it can be applied to the original tablesorter plugin.
- * Thanks to Chris Coyier and his post on [persistent headers](http://css-tricks.com/13465-persistent-headers/).
-* Added a compressed widget file named "jquery.tablesorter.widgets.min.js".
-
-Version 2.0.21 (2011-09-22)
-============================
-
-* Added `sortBegin` event
- * This event is triggered immediately before the actual sort. So this event occurs after the `sortStart` and after the `sortList` option has been updated.
- * It was added to allow for changing the sort dynamically. See [issue #3](https://github.com/Mottie/tablesorter/issues/3).
-* Added `removeRows` option to the pager plugin
- * When `true`, the default value, the pager plugin removes all non-active rows from the table. This greatly increases the sort speed of large tables.
- * When `false`, the pager plugin merely hides the non-active rows so they all continue to exist in the table. This should allow for better access to data within the table (i.e. submitting form elements)
-
-Version 2.0.20.1 (2011-09-16)
-============================
-
-* Oops fixed currency sorting
-
-Version 2.0.20 (2011-09-16)
-============================
-
-* Filter Widget
- * Added "filter" to the "headers" option to allow disabling the filter option for a specific column - thanks jizo!
- * Added "filter-false" class, that when applied will disable the filter widget for that column.
- * Updated the headers docs and the filter widget demo.
-* Updated the currency parser to use unicode characters to better work in different document formats.
-
-Version 2.0.19 (2011-09-16)
-============================
-
-* Added code in attempt to clear the table headers between multiple tables - fix for [issue #2](https://github.com/Mottie/tablesorter/issues/2).
-* Cleaned up some code and wrapped the widget code to prevent conflicts with other javascript libraries.
-* Updated the columns widget:
- * Added css examples to the [demo](http://mottie.github.com/tablesorter/docs/example-widget-columns.html).
- * Removed the `widgetColumns` option from the core, but it is still used by the widget - the way it is used hasn't changed.
-* Updated the uitheme widget:
- * Added `widgetUitheme` option - used by the widget, but not included in the core. See the demo for a better example.
- * Example added to the [uitheme widget demo](http://mottie.github.com/tablesorter/docs/example-widget-columns.html).
-
-Version 2.0.18.1 (2011-09-14)
-============================
-
-* Updated the "uitheme" widget with method to add zebra striping and hovered header classes.
-
-Version 2.0.18 (2011-09-13)
-============================
-
-* Fixed a bug in the column widget, it would cause an error if no initial sort was set.
-* Fixed a bug where an error would occur if a widget doesn't exist.
-* Updated pager widget to allow restoring the pager plugin & updated demo.
-* Added column filter widget. It is designed so that each column has an filter.
-
-Version 2.0.17 (2011-09-11)
-============================
-
-* Added a jquery.tablesorter.widget.js file:
- * It contains the "uitheme" widget, to add any jQuery UI theme, and the new "columns" widget, to style columns.
- * The blue and green themes have been updated with the added styles from the columns widget.
- * Added a Columns Widget demo and instructions.
-* Added a `widgetColumns` option which defines the css classes added by the columns widget.
-* Added notes to the pager plugin demo page to better specify when a change was added.
-* The green theme header images have been modified to better work with variable width tables.
-
-Version 2.0.16 (2011-09-08)
-============================
-
-* Added notes to demo pages to indicate if the original (version 2.0.5, at [tablesorter.com](http://tablesorter.com/docs/)) does have that option or method.
-* Added "addRows" method that allows adding table rows.
- * This method differs from the "update" method in that it only adds rows to the cache.
- * Use this new method to add rows to a table with the pager plugin applied. Using the "update" method on a table with the pager plugin will remove all hidden rows from the cache.
-* Added a "destroy.pager" method to remove the pager from the table - pager demo updated.
-
-Version 2.0.15 (2011-08-23)
-============================
-
-* Fixed a problem that caused a javascript error when a table header cell doesn't have a class name.
-
-Version 2.0.14 (2011-08-22)
-============================
-
-* Reverted the changes made in 2.0.13 and added checks to prevent errors.
-* Allowed sorting an empty table which would then automatically sort its contents when the table is updated.
-* Modified "Update" and "UpdateCell" methods to automatically resort the table using the existing sort.
-* Updated the [Initializing tablesorter on an empty table](http://mottie.github.com/tablesorter/docs/example-empty-table.html) demo and [Updating a table cell](http://mottie.github.com/tablesorter/docs/example-update-cell.html).
-
-Version 2.0.13 (2011-08-19)
-============================
-
-* Fixed a problem where a javascript error would occur when initializing a multi sort on an empty table. Thanks again to Eugene Ivakhiv!
-
-Version 2.0.12 (2011-08-19)
-============================
-
-* Updated the `textExtraction` functionality
- * The original textExtraction function was only able to be applied to all the cells in the table.
- * Apparently the ability to define textExtraction on a per column basis was misinterpreted by me, so now I've added it.
- * Use the option as follows:
-
- $("table").tablesorter({
- textExtraction: {
- 0: function(node) { return $(node).find(selector1).text(); },
- 1: function(node) { return $(node).find(selector2).text(); },
- // etc
- }
- });
-
- * Updated the [Dealing with markup inside cells](http://mottie.github.com/tablesorter/docs/example-option-text-extraction.html) demo.
- * Thanks to Eugene Ivakhiv for reporting this issue to my attention in my blog.
-
-
-Version 2.0.11 (2011-08-04)
-============================
-
-* Added the ability to set a column parser using a class name
- * When setting the parser, start the class name with "sorter-" followed by the parser name, e.g. "sorter-text" or "sorter-digit"
- * The column can be disabled by setting the class name to "sorter-false"
- * [Demo page](http://mottie.github.com/tablesorter/docs/example-parsers-class-name.html) included.
- * Custom parsers can also be used - see the updated [writing custom parsers demo](http://mottie.github.com/tablesorter/docs/example-parsers.html).
-
-Version 2.0.10 (2011-07-31)
-============================
-
-* Modified the numeric sort with a new method to deal with non-numeric content:
- * When sorting columns with numeric values, by default any non-numeric or empty cells are treated as if they have a zero value. This puts the text between negative and positive values in a column.
- * Adding `string : "max+"` to the `headers` option will now treat any non-numeric table cells as if they have a maxiumum positive value (a value greater than the maximum positive value in the column).
- * Adding `string : "max-"` to the `headers` option will now treat any non-numeric table cells as if they have a maxiumum negative value (a value greater than the maximum negative value in the column).
- * See the "[Dealing with text strings in numeric sorts](http://mottie.github.com/tablesorter/docs/example-options-headers-digits-strings.html)" demo for a better visual example.
-* Changed UI theme widget code to use "ui-widget-header" instead of "ui-widget-default" to better match the themes.
-* Renamed changelog.markdown to changelog.txt to prevent downloading when clicking on the link
-
-Version 2.0.9 (2011-07-27)
-============================
-
-* Added a jQuery UI theme and widget example. To apply the jQuery UI theme:
- * Include any jQuery UI theme on your page.
- * Add the base tablesorter ui theme (located in css/ui directory)
- * Add the jQuery UI theme widget code found on [this example page](http://mottie.github.com/tablesorter/docs/example-ui-theme.html). This demo page includes the UI theme switcher.
-* Added a header index to the `onRenderHeader` function to make it easier to target specific header cells for modification. See the [render header example](http://mottie.github.com/tablesorter/docs/example-option-render-header.html) for an example.
-* Pager plugin updates:
- * Removed the `separator` option and added an `output` option which allows you to completely customize the output string.
- * In the `output` string, include any of the following variables:
- * `{page}` is replaced with the current page number.
- * `{totalPages}` is replaced with the total number of pages.
- * `{startRow}` is replaced with the number of the visible start row of the pager.
- * `{endRow}` is replaced with the number of the visible end row of the pager.
- * `{totalRows}` is replaced with the total number of rows.
- * The `cssPageDisplay` option can now target any element; in previous versions, this element was an input of type text.
- * Added a `pagerArrows` and `cssDisabled` options:
- * When `pagerArrows` is true, the first and previous pager arrows have the css class name contained in the `cssDisabled` option applied when the first row is visible.
- * The next and last pager arrows will be have the `cssDisabled` class applied when the last row is visible.
- * Additionally, if the number of table rows is less than the pager size, the pager will get the `cssDisabled` class name applied.
- * If false (the default setting), the pager arrows class names will not change.
- * Please see the updated [pager demo](http://mottie.github.com/tablesorter/docs/example-pager.html) to see this working.
-
-Version 2.0.8 (2011-07-21)
-============================
-
-* Fixed parsers for currency and digits to work with number values separated by commas. Thanks to Josh Renaud for the information!
-* Fixed "lockedOrder" header option and added documentation and an example on how to use it.
-* Made the sort order "desc" only trigger off of the first letter, so any word/abbreviation starting with "d" will set the descending sort order, all other letters will set the order to ascending (shhh, because I'm a bad speller :P)
-* Modified the "sortInitialOrder" option so it can also be set in the headers option.
-
-Version 2.0.7 (2011-07-17)
-============================
-
-* Added "pagerChange" and "pagerComplete" events to the pager plugin which trigger on the table. See the [pager demo](http://mottie.github.com/tablesorter/docs/example-pager.html) for an example on how to bind to them.
-* Added the "sortAppend" since the option was there, but apparently the code wasn't.
-* Added missing documentation from [my blog post](http://wowmotty.blogspot.com/2011/06/jquery-tablesorter-missing-docs.html)
- * This included a few new example pages: apply widgets, child rows, render header, sort append and zebra widget.
- * Added a methods and events table.
-* Fixed the minified version. Apparently sorting functions called by the eval were removed by the Google Closure Compiler. Resolved by using "Whitespace only" optimization.
-* Fixed syntax highlighting; updated Chili.
-
-Version 2.0.6 (2011-06-22)
-============================
-
-* Forked original files and docs from [tablesorter.com](http://tablesorter.com) to GitHub.
-* Replaced alphabetical sort with an alphanumeric sort
- * This "slower" sort can be disabled by setting the `sortLocaleCompare` option to `true`
- * The `sortLocaleCompare` option's default was changed to `false`.
- * Added a very basic demo.
-* Added `tableClass` option
- * The value is "tablesorter" by default and should no longer be required in the default markup.
- * This class is applied to the table in the script and should match the css styling.
-* Each header cell now has its content wrapped with a span.
- * This allows applying the direction icon to the span instead of the entire cell.
- * Although, this might just be extra markup with the advent of multiple background images and gradient backgrounds available in CSS3.
-* Reformatted the code to make jSLint "happier".
-
-Version 2.0.5b (?)
-============================
-
-* General
- * Added "cssChildRow" option - attach a child row to its parent.
- * Added "sortLocaleCompare" to use the native `String.localeCampare` method during text sort.
- * Added "onRenderHeader" function that is called when classes are added to the header cells.
- * Added "selectorHeaders" option to target the the header cells.
- * Changed multisort function
-
-Version 2.0.3 (2008-03-17)
-============================
-
-* Bug fixes - Missing semicolon, broke the minified version.
-
-Version 2.0.2 (2008-03-14)
-============================
-
-* General
- * Added support for the new metadata plugin.
- * Added support for jQuery 1.2.3.
- * Added support for decimal numbers and negative and positive digits.
- * Updated documenation and website with new examples.
- * Removed packed version.
-
-* Bug fixes
- * Sort force (Thanks to David Lynch).
-
-Version 2.0.1 (2007-09-17)
-============================
-
-* General
- * Removed the need for Dimensions plugin when using the pagnation plugin thanks to offset being included in the jQuery 1.2 core.
- * Added support for jQuery 1.2.
- * Added new Minified version of tablesorter.
- * Updated documenation and website with new examples.
-
-* Bug fixes
- * If row values are identical the original order is kept (Thanks to David hull).
- * If thead includes a table $('tbody:first', table) breaks (Thanks to David Hull).
-
-* Speed improvements:
- * appendToTable, setting innerHTML to "" before appending new content to table body.
- * zebra widget. (Thanks to James Dempster).
+Change log moved to the wiki documentation pages:
+https://github.com/Mottie/tablesorter/wiki/Change
View
145 docs/example-option-sort-empty.html
@@ -0,0 +1,145 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>jQuery plugin: Tablesorter 2.0 - Sorting empty cells</title>
+
+ <!-- jQuery -->
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
+
+ <!-- Demo stuff -->
+ <link rel="stylesheet" href="css/jq.css">
+ <script src="js/chili/jquery.chili-2.2.js"></script>
+ <script src="js/chili/recipes.js"></script>
+ <script src="js/docs.js"></script>
+
+ <!-- Tablesorter: required -->
+ <link rel="stylesheet" href="../css/blue/style.css">
+ <script src="../js/jquery.tablesorter.js"></script>
+
+ <script id="js">$(function() {
+ // call the tablesorter plugin
+ $("table").tablesorter({
+ emptyToBottom: true
+ });
+});</script>
+
+<script>
+$(function(){
+ $('select').change(function(){
+ var t = $('table'),
+ etb = $(this).val(),
+ v = (etb === 'true') ? true : (etb === 'false' ? false : null);
+ t[0].config.emptyToBottom = v;
+ t.trigger("sorton", [t[0].config.sortList]);
+ });
+});
+</script>
+</head>
+<body>
+<div id="banner">
+ <h1>table<em>sorter</em></h1>
+ <h2>Sorting empty cells</h2>
+ <h3>Flexible client-side table sorting</h3>
+ <a href="index.html">Back to documentation</a>
+</div>
+<div id="main">
+
+ <p class="tip">
+ <em>NOTE!</em>
+ Set the <code class="hilight">emptyToBottom</code> selector below:
+ <ul>
+ <li>true - sort empty table cells to the bottom.</li>
+ <li>false - sort empty table cells to the top.</li>
+ <li>null - sort empty table cells as if the cell has the lowest value (less than "a" and "0").</li>
+ </ul>
+ </p>
+
+<h1>Demo</h1>
+
+Set <code class="hilight">emptyToBottom</code> option: <select>
+ <option>true</option>
+ <option>false</option>
+ <option>null</option>
+</select>
+
+<div id="demo"><table class="tablesorter">
+ <thead>
+ <tr>
+ <th>Account #</th>
+ <th>First Name</th>
+ <th>Last Name</th>
+ <th>Age</th>
+ <th>Total</th>
+ <th>Discount</th>
+ <th>Diff</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>A43</td>
+ <td>Peter</td>
+ <td>Parker</td>
+ <td>28</td>
+ <td></td>
+ <td>20.3%</td>
+ <td>+3</td>
+ </tr>
+ <tr>
+ <td>A255</td>
+ <td></td>
+ <td>Hood</td>
+ <td></td>
+ <td>19.99</td>
+ <td>25.1%</td>
+ <td>-7</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>Clark</td>
+ <td></td>
+ <td>18</td>
+ <td>15.89</td>
+ <td>44.2%</td>
+ <td>-15</td>
+ </tr>
+ <tr>
+ <td>A1</td>
+ <td>Bruce</td>
+ <td>Almighty</td>
+ <td>45</td>
+ <td>153.19</td>
+ <td></td>
+ <td>+19</td>
+ </tr>
+ <tr>
+ <td>A102</td>
+ <td>Bruce</td>
+ <td>Evans</td>
+ <td>56</td>
+ <td>153.19</td>
+ <td>23%</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table></div>
+
+ <h1>Javascript</h1>
+ <div id="javascript">
+ <pre class="js"></pre>
+ </div>
+ <h1>HTML</h1>
+ <div id="html">
+ <pre class="html"></pre>
+ </div>
+
+<div class="next-up">
+ <hr />
+ Next up: <a href="example-option-sort-key.html">Change the default multi-sorting key &rsaquo;&rsaquo;</a>
+</div>
+
+</div>
+
+</body>
+</html>
+
View
2 docs/example-option-sortreset-sortrestart.html
@@ -125,7 +125,7 @@
<div class="next-up">
<hr />
- Next up: <a href="example-option-sort-key.html">Change the default multi-sorting key &rsaquo;&rsaquo;</a>
+ Next up: <a href="example-option-sort-empty.html">Sorting empty cells &rsaquo;&rsaquo;</a>
</div>
</div>
View
2 docs/example-parsers-advanced.html
@@ -28,7 +28,7 @@
return false;
},
format: function(s, table, cell, cellIndex) {
- var data, $cell = $(cell);
+ var $cell = $(cell);
// I could have used $(cell).data(), then we get back an object which contains both
// data-lastname & data-date; but I wanted to make this demo a bit more straight-forward
// and easier to understand.
View
20 docs/index.html
@@ -36,7 +36,7 @@
</div>
<p>
<strong>Author:</strong> Christian Bach<br>
- <strong>Version:</strong> <a class="current-version" href="http://github.com/Mottie/tablesorter/downloads">2.1+</a> (forked from <a href="http://tablesorter.com/docs/">version 2.0.5</a>, <a href="../changelog.txt">changelog</a>)<br>
+ <strong>Version:</strong> <a class="current-version" href="http://github.com/Mottie/tablesorter/downloads">2.1+</a> (forked from <a href="http://tablesorter.com/docs/">version 2.0.5</a>, <a href="https://github.com/Mottie/tablesorter/wiki/Change">changelog</a>)<br>
<strong>Licence:</strong>
Dual licensed under <a class="external" href="http://www.opensource.org/licenses/mit-license.php">MIT</a>
or <a class="external" href="http://www.opensource.org/licenses/gpl-license.php">GPL</a> licenses.
@@ -288,6 +288,7 @@
<li><a href="example-options-headers-locked.html">Lock sort order using header options</a></li>
<li><a href="example-options-headers-order.html">Set initial sort order using header options</a></li>
<li><a href="example-option-sortreset-sortrestart.html">Using sortReset &amp; sortRestart options</a></li>
+ <li><a href="example-option-sort-empty.html">Sorting empty cells</a> <span class="tip"><em>New!</em></span> v2.1.11</li>
<li><a href="example-option-sort-key.html">Change the default multi-sorting key</a></li>
</ul>
@@ -561,6 +562,23 @@
<td><a href="example-option-debug.html">Example</a></td>
</tr>
+ <tr id="emptytobottom">
+ <td><a href="#" class="toggle2">emptyToBottom</a></td>
+ <td>Boolean</td>
+ <td>true</td>
+ <td>
+ Boolean flag indicating how tablesorter should deal with empty table cells. <span class="tip"><em>New!</em></span> v2.1.11
+ <div class="collapsible">
+ <ul>
+ <li><code class="hilight">true</code> - sort empty table cells to the bottom.</li>
+ <li><code class="hilight">false</code> - sort empty table cells to the top.</li>
+ <li><code class="hilight">null</code> - sort empty table cells as if the cell has the lowest value (less than "a" and "0").</li>
+ </ul>
+ </div>
+ </td>
+ <td><a href="example-option-sort-empty.html">Example</a></td>
+ </tr>
+
<tr id="headerlist">
<td>headerList</td>
<td>Array</td>
View
42 js/jquery.tablesorter.js
@@ -1,5 +1,5 @@
/*!
-* TableSorter 2.1.10 - Client-side table sorting with ease!
+* TableSorter 2.1.11 - Client-side table sorting with ease!
* @requires jQuery v1.2.6+
*
* Copyright (c) 2007 Christian Bach
@@ -18,7 +18,7 @@
$.extend({
tablesorter: new function(){
- this.version = "2.1.10";
+ this.version = "2.1.11";
var parsers = [], widgets = [], tbl;
this.defaults = {
@@ -33,6 +33,7 @@
sortLocaleCompare: false,
sortReset: false,
sortRestart: false,
+ emptyToBottom : true, // sort empty cell to bottom
textExtraction: "simple",
parsers: {},
widgets: [],
@@ -373,6 +374,7 @@
return $tableHeaders;
}
+ // Part of original tablesorter - not even called.
function checkCellColSpan(table, rows, row) {
var i, cell, arr = [],
r = table.tHead.rows,
@@ -404,7 +406,7 @@
var h = [], i, l, css = [table.config.cssDesc, table.config.cssAsc];
// remove all header information
$headers.removeClass(css[0]).removeClass(css[1]);
- $headers.each(function (offset) {
+ $headers.each(function() {
if (!this.sortDisabled) {
h[this.column] = $(this);
}
@@ -416,7 +418,7 @@
}
}
- function fixColumnWidth(table, $headers) {
+ function fixColumnWidth(table) {
if (table.config.widthFixed) {
var colgroup = $('<colgroup>');
$("tr:first td", table.tBodies[0]).each(function () {
@@ -479,12 +481,13 @@
// Natural sort modified from: http://www.webdeveloper.com/forum/showthread.php?t=107909
function sortText(a, b) {
+ var c = tbl[0].config, cnt = 0, L, t, x;
if (a === b) { return 0; }
- if (a === '') { return 1; }
- if (b === '') { return -1; }
- if ($.data(tbl[0], "tablesorter").sortLocaleCompare) { return a.localeCompare(b); }
+ if (a === '' && c.emptyToBottom !== null) { return c.emptyToBottom ? 1 : -1; }
+ if (b === '' && c.emptyToBottom !== null) { return c.emptyToBottom ? -1 : 1; }
+ if (c.sortLocaleCompare) { return a.localeCompare(b); }
try {
- var cnt = 0, ax, t, x = /^(\.)?\d/,
+ x = /^(\.)?\d/;
L = Math.min(a.length, b.length) + 1;
while (cnt < L && a.charAt(cnt) === b.charAt(cnt) && x.test(b.substring(cnt)) === false && x.test(a.substring(cnt)) === false) { cnt++; }
a = a.substring(cnt);
@@ -509,10 +512,11 @@
}
function sortTextDesc(a, b){
+ var c = tbl[0].config;
if (a === b) { return 0; }
- if (a === '') { return 1; }
- if (b === '') { return -1; }
- if ($.data(tbl[0], "tablesorter").sortLocaleCompare) { return b.localeCompare(a); }
+ if (a === '' && c.emptyToBottom !== null) { return c.emptyToBottom ? 1 : -1; }
+ if (b === '' && c.emptyToBottom !== null) { return c.emptyToBottom ? -1 : 1; }
+ if (c.sortLocaleCompare) { return b.localeCompare(a); }
return -sortText(a, b);
}
@@ -532,18 +536,20 @@
}
function sortNumeric(a, b, mx, d) {
+ var c = tbl[0].config;
if (a === b) { return 0; }
- if (a === '') { return 1; }
- if (b === '') { return -1; }
+ if (a === '' && c.emptyToBottom !== null) { return c.emptyToBottom ? 1 : -1; }
+ if (b === '' && c.emptyToBottom !== null) { return c.emptyToBottom ? -1 : 1; }
if (isNaN(a)) { a = getTextValue(a, mx, d); }
if (isNaN(b)) { b = getTextValue(b, mx, d); }
return a - b;
}
function sortNumericDesc(a, b, mx, d) {
+ var c = tbl[0].config;
if (a === b) { return 0; }
- if (a === '') { return 1; }
- if (b === '') { return -1; }
+ if (a === '' && c.emptyToBottom !== null) { return c.emptyToBottom ? 1 : -1; }
+ if (b === '' && c.emptyToBottom !== null) { return c.emptyToBottom ? -1 : 1; }
if (isNaN(a)) { a = getTextValue(a, mx, d); }
if (isNaN(b)) { b = getTextValue(b, mx, d); }
return b - a;
@@ -555,8 +561,8 @@
// if no thead or tbody quit.
if (!this.tHead || this.tBodies.length === 0) { return; }
// declare
- var $this, $document, $headers, cache, config, shiftDown = 0,
- sortOrder, totalRows, $cell, c, i, j, k, a, s, o;
+ var $this, $headers, cache, config,
+ totalRows, $cell, c, i, j, k, a, s, o;
// new blank config object
this.config = {};
// merge and extend.
@@ -945,7 +951,7 @@
time = new Date();
}
// loop through the visible rows
- $("tr:visible", table.tBodies[0]).each(function(i){
+ $("tr:visible", table.tBodies[0]).each(function(){
$tr = $(this);
// style children rows the same way the parent row was styled
if (!$tr.hasClass(child)) { row++; }
View
4 js/jquery.tablesorter.min.js
@@ -1,6 +1,6 @@
/*!
-* TableSorter 2.1.10 - Client-side table sorting with ease!
+* TableSorter 2.1.11 - Client-side table sorting with ease!
* Minified using http://dean.edwards.name/packer/
* Copyright (c) 2007 Christian Bach
*/
-!(function($){$.extend({tablesorter:new function(){this.version="2.1.10";var g=[],widgets=[],tbl;this.defaults={cssHeader:"tablesorter-header",cssAsc:"tablesorter-headerSortUp",cssDesc:"tablesorter-headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,sortReset:false,sortRestart:false,textExtraction:"simple",parsers:{},widgets:[],headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"mmddyyyy",usNumberFormat:true,onRenderHeader:null,selectorHeaders:'thead th',selectorRemove:"tr.remove-me",tableClass:'tablesorter',debug:false,widgetOptions:{zebra:["even","odd"]}};function log(s){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(s)}else{alert(s)}}function benchmark(s,d){log(s+" ("+(new Date().getTime()-d.getTime())+"ms)")}this.benchmark=benchmark;this.hasInitialized=false;function getElementText(a,b,c){var d="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b,tbl,c)}else if(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b,tbl,c)}else{d=$(b).text()}}return d}function getParserById(a){var i,l=g.length;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===(a.toString()).toLowerCase()){return g[i]}}return false}function trimAndGetNodeText(a,b,c){return $.trim(getElementText(a,b,c))}function detectParserForColumn(a,b,c,d){var i,l=g.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=b[c].cells[d];nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row '+c+', column:'+d+": "+nodeValue)}}else{keepLooking=false}}for(i=1;i<l;i++){if(g[i].is(nodeValue,a,node)){return g[i]}}return g[0]}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(c[0]){list=[];cells=c[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$(b[i]);if($.metadata&&(h.metadata()&&h.metadata().sorter)){p=getParserById(h.metadata().sorter)}else if((a.config.headers[i]&&a.config.headers[i].sorter)){p=getParserById(a.config.headers[i].sorter)}else if(h.attr('class')&&h.attr('class').match('sorter-')){p=getParserById(h.attr('class').match(/sorter-(\w+)/)[1]||'')}if(!p){p=detectParserForColumn(a,c,-1,i)}if(a.config.debug){parsersDebug+="column:"+i+"; parser:"+p.id+"\n"}list.push(p)}}if(a.config.debug){log(parsersDebug)}return list}function buildCache(a){var b=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,g=a.config.parsers,cache={row:[],normalized:[]},t,i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=new Date()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j){t=trimAndGetNodeText(a.config,c[0].cells[j],j);cols.push(g[j].format(t,a,c[0].cells[j],j))}cols.push(cache.normalized.length);cache.normalized.push(cols)}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows",cacheTime)}a.config.cache=cache;return cache}function getWidgetById(a){var i,w,l=widgets.length;for(i=0;i<l;i++){w=widgets[i];if(w&&w.hasOwnProperty('id')&&w.id.toLowerCase()===a.toLowerCase()){return w}}}function applyWidget(a,b){var c=a.config.widgets,i,w,l=c.length;for(i=0;i<l;i++){w=getWidgetById(c[i]);if(w){if(b&&w.hasOwnProperty('init')){w.init(a,widgets,w)}else if(!b&&w.hasOwnProperty('format')){w.format(a)}}}}function appendToTable(a,b){var c=a.config,r=b.row,n=b.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,rows=[],i,j,l,pos,appendTime;if(c.debug){appendTime=new Date()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!c.appender||!c.removeRows){l=r[pos].length;for(j=0;j<l;j++){a.tBodies[0].appendChild(r[pos][j])}}}if(c.appender){c.appender(a,rows)}if(c.debug){benchmark("Rebuilt table",appendTime)}applyWidget(a);$(a).trigger("sortEnd",a)}function computeTableHeaderCellIndexes(t){var a=[],lookup={},thead=t.getElementsByTagName('THEAD')[0],trs=thead.getElementsByTagName('TR'),i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof(a[rowIndex])==="undefined"){a[rowIndex]=[]}for(k=0;k<a[rowIndex].length+1;k++){if(typeof(a[rowIndex][k])==="undefined"){firstAvailCol=k;break}}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(a[k])==="undefined"){a[k]=[]}matrixrow=a[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x"}}}}return lookup}function formatSortingOrder(v){return(/^d/i.test(v)||v===1)}function checkHeaderMetadata(a){return(($.metadata)&&($(a).metadata().sorter===false))}function checkHeaderOptions(a,i){return((a.config.headers[i])&&(a.config.headers[i].sorter===false))}function checkHeaderLocked(a,i){if((a.config.headers[i])&&(a.config.headers[i].lockedOrder!==null)){return a.config.headers[i].lockedOrder}return false}function checkHeaderOrder(a,i){if((a.config.headers[i])&&(a.config.headers[i].sortInitialOrder)){return a.config.headers[i].sortInitialOrder}return a.config.sortInitialOrder}function buildHeaders(b){var d=($.metadata)?true:false,header_index=computeTableHeaderCellIndexes(b),$th,lock,time,$tableHeaders,c=b.config;c.headerList=[];if(c.debug){time=new Date()}$tableHeaders=$(c.selectorHeaders,b).wrapInner("<div class='tablesorter-header-inner' />").each(function(a){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(b,a))?[1,0,2]:[0,1,2];this.count=-1;if(checkHeaderMetadata(this)||checkHeaderOptions(b,a)||$(this).hasClass('sorter-false')){this.sortDisabled=true}this.lockedOrder=false;lock=checkHeaderLocked(b,a);if(typeof(lock)!=='undefined'&&lock!==false){this.order=this.lockedOrder=formatSortingOrder(lock)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){$th=$(this).addClass(c.cssHeader);if(c.onRenderHeader){c.onRenderHeader.apply($th,[a])}}c.headerList[a]=this;$(this).parent().addClass(c.cssHeader)});if(c.debug){benchmark("Built headers",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(a,b,d){var i,cell,arr=[],r=a.tHead.rows,c=r[d].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(a,b,d++))}else{if(a.tHead.length===1||(cell.rowSpan>1||!r[d+1])){arr.push(cell)}}}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i<l;i++){if(a[i][0]===v){return true}}return false}function setHeadersCss(b,c,d){var h=[],i,l,css=[b.config.cssDesc,b.config.cssAsc];c.removeClass(css[0]).removeClass(css[1]);c.each(function(a){if(!this.sortDisabled){h[this.column]=$(this)}});l=d.length;for(i=0;i<l;i++){if(d[i][1]===2){continue}h[d[i][0]].addClass(css[d[i][1]])}}function fixColumnWidth(a,b){if(a.config.widthFixed){var c=$('<colgroup>');$("tr:first td",a.tBodies[0]).each(function(){c.append($('<col>').css('width',$(this).width()))});$(a).prepend(c)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;i<l;i++){s=b[i];o=c.headerList[s[0]];o.count=s[1]%(c.sortReset?3:2)}}function getCachedSortType(a,i){return(a)?a[i].type:''}function multisort(a,b,d){var f="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=a.config,lc=d.normalized.length,l=b.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=(getCachedSortType(tc.parsers,c)==="text")?((order===0)?"sortText":"sortTextDesc"):((order===0)?"sortNumeric":"sortNumericDesc");e="e"+i;if(/Numeric/.test(s)&&tc.headers[c]&&tc.headers[c].string){for(j=0;j<lc;j++){col=Math.abs(parseFloat(d.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}dir=(tc.headers[c])?tc.string[tc.headers[c].string]||0:0}f+="var "+e+" = "+s+"(a["+c+"],b["+c+"],"+mx+","+dir+"); ";f+="if ("+e+") { return "+e+"; } ";f+="else { "}orgOrderCol=(d.normalized&&d.normalized[0])?d.normalized[0].length-1:0;f+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){f+="}; "}f+="return 0; ";f+="}; ";eval(f);d.normalized.sort(sortWrapper);if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time",sortTime)}return d}function sortText(a,b){if(a===b){return 0}if(a===''){return 1}if(b===''){return-1}if($.data(tbl[0],"tablesorter").sortLocaleCompare){return a.localeCompare(b)}try{var c=0,ax,t,x=/^(\.)?\d/,L=Math.min(a.length,b.length)+1;while(c<L&&a.charAt(c)===b.charAt(c)&&x.test(b.substring(c))===false&&x.test(a.substring(c))===false){c++}a=a.substring(c);b=b.substring(c);if(x.test(a)||x.test(b)){if(x.test(a)===false){return(a)?1:-1}else if(x.test(b)===false){return(b)?-1:1}else{t=parseFloat(a)-parseFloat(b);if(t!==0){return t}else{t=a.search(/[^\.\d]/)}if(t===-1){t=b.search(/[^\.\d]/)}a=a.substring(t);b=b.substring(t)}}return(a>b)?1:-1}catch(er){return 0}}function sortTextDesc(a,b){if(a===b){return 0}if(a===''){return 1}if(b===''){return-1}if($.data(tbl[0],"tablesorter").sortLocaleCompare){return b.localeCompare(a)}return-sortText(a,b)}function getTextValue(a,b,d){if(b){var i,l=a.length,n=b+d;for(i=0;i<l;i++){n+=a.charCodeAt(i)}return d*n}return 0}function sortNumeric(a,b,c,d){if(a===b){return 0}if(a===''){return 1}if(b===''){return-1}if(isNaN(a)){a=getTextValue(a,c,d)}if(isNaN(b)){b=getTextValue(b,c,d)}return a-b}function sortNumericDesc(a,b,c,d){if(a===b){return 0}if(a===''){return 1}if(b===''){return-1}if(isNaN(a)){a=getTextValue(a,c,d)}if(isNaN(b)){b=getTextValue(b,c,d)}return b-a}this.construct=function(f){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var d,$document,$headers,cache,config,shiftDown=0,sortOrder,totalRows,$cell,c,i,j,k,a,s,o;this.config={};c=config=$.extend(true,this.config,$.tablesorter.defaults,f);tbl=d=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",c);$headers=buildHeaders(this);c.parsers=buildParserCache(this,$headers);c.string={max:1,'max+':1,'max-':-1,none:0};cache=buildCache(this);fixColumnWidth(this);$headers.click(function(e){totalRows=(d[0].tBodies[0]&&d[0].tBodies[0].rows.length)||0;if(!this.sortDisabled){d.trigger("sortStart",tbl[0]);$cell=$(this);k=!e[c.sortMultiSortKey];this.count=(this.count+1)%(c.sortReset?3:2);if(c.sortRestart){i=this;$headers.each(function(){if(this!==i&&(k||!$(this).is('.'+c.cssDesc+',.'+c.cssAsc))){this.count=-1}})}i=this.column;if(k){c.sortList=[];if(c.sortForce!==null){a=c.sortForce;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}else{if(isValueInArray(i,c.sortList)){for(j=0;j<c.sortList.length;j++){s=c.sortList[j];o=c.headerList[s[0]];if(s[0]===i){s[1]=o.order[o.count];if(s[1]===2){c.sortList.splice(j,1);o.count=-1}}}}else{if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}}if(c.sortAppend!==null){a=c.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}d.trigger("sortBegin",tbl[0]);setHeadersCss(d[0],$headers,c.sortList);appendToTable(d[0],multisort(d[0],c.sortList,cache));return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});d.bind("update",function(){var t=this,c=t.config;$(c.selectorRemove,t.tBodies[0]).remove();t.config.parsers=buildParserCache(t,$headers);cache=buildCache(t);d.trigger("sorton",[t.config.sortList])}).bind("updateCell",function(e,a){var b=[(a.parentNode.rowIndex-1),a.cellIndex];cache.normalized[b[0]][b[1]]=c.parsers[b[1]].format(getElementText(c,a,b[1]),d,a,b[1]);c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("addRows",function(e,a){var i,rows=a.filter('tr').length,dat=[],l=a[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=c.parsers[j].format(getElementText(c,a[i].cells[j],j),d,a[i].cells[j],j)}dat.push(cache.row.length);cache.row.push([a[i]]);cache.normalized.push(dat);dat=[]}c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("sorton",function(e,a){$(this).trigger("sortStart",tbl[0]);c.sortList=a;var b=c.sortList;updateHeaderSortCount(this,b);setHeadersCss(this,$headers,b);appendToTable(this,multisort(this,b,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,a){getWidgetById(a).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){c.sortList=$(this).metadata().sortlist}applyWidget(this,true);if(c.sortList.length>0){d.trigger("sorton",[c.sortList])}else{applyWidget(this)}this.hasInitialized=true})};this.addParser=function(b){var i,l=g.length,a=true;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===b.id.toLowerCase()){a=false}}if(a){g.push(b)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(s){if(typeof(s)!=='string'){return s}if(tbl[0].config.usNumberFormat){s=s.replace(/,/g,'')}else{s=s.replace(/[\s|\.]/g,'').replace(/,/g,'.')}var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return(/^[\-+]?\d*$/).test($.trim(s.replace(/[,.'\s]/g,'')))};this.clearTableBody=function(a){$(a.tBodies[0]).empty()}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var m=$.tablesorter;m.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});m.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s)},format:function(s){return $.tablesorter.formatFloat(s)},type:"numeric"});m.addParser({id:"currency",is:function(s){return(/^[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9,. \-]/g),""))},type:"numeric"});m.addParser({id:"ipAddress",is:function(s){return(/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2){r+="0"+item}else{r+=item}}return $.tablesorter.formatFloat(r)},type:"numeric"});m.addParser({id:"url",is:function(s){return(/^(https?|ftp|file):\/\/$/).test(s)},format:function(s){return $.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''))},type:"text"});m.addParser({id:"isoDate",is:function(s){return(/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s)},format:function(s){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"")},type:"numeric"});m.addParser({id:"percent",is:function(s){return(/\%$/).test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""))},type:"numeric"});m.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"shortDate",is:function(s){return(/\d{1,4}[\/\-\,\.\s+]\d{1,4}[\/\-\.\,\s+]\d{1,4}/).test(s)},format:function(s,a,b,d){var c=a.config,format=(c.headers&&c.headers[d])?c.headers[d].dateFormat||c.dateFormat:c.dateFormat;s=s.replace(/\s+/g," ").replace(/[\-|\.|\,|\s]/g,"/");if(format==="mmddyyyy"){s=s.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/,"$3/$1/$2")}else if(format==="ddmmyyyy"){s=s.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/,"$3/$2/$1")}else if(format==="yyyymmdd"){s=s.replace(/(\d{4})\/(\d{1,2})\/(\d{1,2})/,"$1/$2/$3")}return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"time",is:function(s){return(/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/).test(s)},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime())},type:"numeric"});m.addParser({id:"metadata",is:function(s){return false},format:function(s,a,b){var c=a.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(b).metadata()[p]},type:"numeric"});m.addWidget({id:"zebra",format:function(a){var b,row=0,even,time,c=a.config,child=c.cssChildRow,css=["even","odd"];css=c.widgetZebra&&c.hasOwnProperty('css')?c.widgetZebra.css:(c.widgetOptions&&c.widgetOptions.hasOwnProperty('zebra'))?c.widgetOptions.zebra:css;if(a.config.debug){time=new Date()}$("tr:visible",a.tBodies[0]).each(function(i){b=$(this);if(!b.hasClass(child)){row++}even=(row%2===0);b.removeClass(css[even?1:0]).addClass(css[even?0:1])});if(a.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);
+!(function($){$.extend({tablesorter:new function(){this.version="2.1.11";var g=[],widgets=[],tbl;this.defaults={cssHeader:"tablesorter-header",cssAsc:"tablesorter-headerSortUp",cssDesc:"tablesorter-headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,sortReset:false,sortRestart:false,emptyToBottom:true,textExtraction:"simple",parsers:{},widgets:[],headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"mmddyyyy",usNumberFormat:true,onRenderHeader:null,selectorHeaders:'thead th',selectorRemove:"tr.remove-me",tableClass:'tablesorter',debug:false,widgetOptions:{zebra:["even","odd"]}};function log(s){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(s)}else{alert(s)}}function benchmark(s,d){log(s+" ("+(new Date().getTime()-d.getTime())+"ms)")}this.benchmark=benchmark;this.hasInitialized=false;function getElementText(a,b,c){var d="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b,tbl,c)}else if(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b,tbl,c)}else{d=$(b).text()}}return d}function getParserById(a){var i,l=g.length;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===(a.toString()).toLowerCase()){return g[i]}}return false}function trimAndGetNodeText(a,b,c){return $.trim(getElementText(a,b,c))}function detectParserForColumn(a,b,c,d){var i,l=g.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=b[c].cells[d];nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row '+c+', column:'+d+": "+nodeValue)}}else{keepLooking=false}}for(i=1;i<l;i++){if(g[i].is(nodeValue,a,node)){return g[i]}}return g[0]}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(c[0]){list=[];cells=c[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$(b[i]);if($.metadata&&(h.metadata()&&h.metadata().sorter)){p=getParserById(h.metadata().sorter)}else if((a.config.headers[i]&&a.config.headers[i].sorter)){p=getParserById(a.config.headers[i].sorter)}else if(h.attr('class')&&h.attr('class').match('sorter-')){p=getParserById(h.attr('class').match(/sorter-(\w+)/)[1]||'')}if(!p){p=detectParserForColumn(a,c,-1,i)}if(a.config.debug){parsersDebug+="column:"+i+"; parser:"+p.id+"\n"}list.push(p)}}if(a.config.debug){log(parsersDebug)}return list}function buildCache(a){var b=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,g=a.config.parsers,cache={row:[],normalized:[]},t,i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=new Date()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j){t=trimAndGetNodeText(a.config,c[0].cells[j],j);cols.push(g[j].format(t,a,c[0].cells[j],j))}cols.push(cache.normalized.length);cache.normalized.push(cols)}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows",cacheTime)}a.config.cache=cache;return cache}function getWidgetById(a){var i,w,l=widgets.length;for(i=0;i<l;i++){w=widgets[i];if(w&&w.hasOwnProperty('id')&&w.id.toLowerCase()===a.toLowerCase()){return w}}}function applyWidget(a,b){var c=a.config.widgets,i,w,l=c.length;for(i=0;i<l;i++){w=getWidgetById(c[i]);if(w){if(b&&w.hasOwnProperty('init')){w.init(a,widgets,w)}else if(!b&&w.hasOwnProperty('format')){w.format(a)}}}}function appendToTable(a,b){var c=a.config,r=b.row,n=b.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,rows=[],i,j,l,pos,appendTime;if(c.debug){appendTime=new Date()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!c.appender||!c.removeRows){l=r[pos].length;for(j=0;j<l;j++){a.tBodies[0].appendChild(r[pos][j])}}}if(c.appender){c.appender(a,rows)}if(c.debug){benchmark("Rebuilt table",appendTime)}applyWidget(a);$(a).trigger("sortEnd",a)}function computeTableHeaderCellIndexes(t){var a=[],lookup={},thead=t.getElementsByTagName('THEAD')[0],trs=thead.getElementsByTagName('TR'),i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof(a[rowIndex])==="undefined"){a[rowIndex]=[]}for(k=0;k<a[rowIndex].length+1;k++){if(typeof(a[rowIndex][k])==="undefined"){firstAvailCol=k;break}}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(a[k])==="undefined"){a[k]=[]}matrixrow=a[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x"}}}}return lookup}function formatSortingOrder(v){return(/^d/i.test(v)||v===1)}function checkHeaderMetadata(a){return(($.metadata)&&($(a).metadata().sorter===false))}function checkHeaderOptions(a,i){return((a.config.headers[i])&&(a.config.headers[i].sorter===false))}function checkHeaderLocked(a,i){if((a.config.headers[i])&&(a.config.headers[i].lockedOrder!==null)){return a.config.headers[i].lockedOrder}return false}function checkHeaderOrder(a,i){if((a.config.headers[i])&&(a.config.headers[i].sortInitialOrder)){return a.config.headers[i].sortInitialOrder}return a.config.sortInitialOrder}function buildHeaders(b){var d=($.metadata)?true:false,header_index=computeTableHeaderCellIndexes(b),$th,lock,time,$tableHeaders,c=b.config;c.headerList=[];if(c.debug){time=new Date()}$tableHeaders=$(c.selectorHeaders,b).wrapInner("<div class='tablesorter-header-inner' />").each(function(a){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(b,a))?[1,0,2]:[0,1,2];this.count=-1;if(checkHeaderMetadata(this)||checkHeaderOptions(b,a)||$(this).hasClass('sorter-false')){this.sortDisabled=true}this.lockedOrder=false;lock=checkHeaderLocked(b,a);if(typeof(lock)!=='undefined'&&lock!==false){this.order=this.lockedOrder=formatSortingOrder(lock)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){$th=$(this).addClass(c.cssHeader);if(c.onRenderHeader){c.onRenderHeader.apply($th,[a])}}c.headerList[a]=this;$(this).parent().addClass(c.cssHeader)});if(c.debug){benchmark("Built headers",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(a,b,d){var i,cell,arr=[],r=a.tHead.rows,c=r[d].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(a,b,d++))}else{if(a.tHead.length===1||(cell.rowSpan>1||!r[d+1])){arr.push(cell)}}}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i<l;i++){if(a[i][0]===v){return true}}return false}function setHeadersCss(a,b,c){var h=[],i,l,css=[a.config.cssDesc,a.config.cssAsc];b.removeClass(css[0]).removeClass(css[1]);b.each(function(){if(!this.sortDisabled){h[this.column]=$(this)}});l=c.length;for(i=0;i<l;i++){if(c[i][1]===2){continue}h[c[i][0]].addClass(css[c[i][1]])}}function fixColumnWidth(a){if(a.config.widthFixed){var b=$('<colgroup>');$("tr:first td",a.tBodies[0]).each(function(){b.append($('<col>').css('width',$(this).width()))});$(a).prepend(b)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;i<l;i++){s=b[i];o=c.headerList[s[0]];o.count=s[1]%(c.sortReset?3:2)}}function getCachedSortType(a,i){return(a)?a[i].type:''}function multisort(a,b,d){var f="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=a.config,lc=d.normalized.length,l=b.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=(getCachedSortType(tc.parsers,c)==="text")?((order===0)?"sortText":"sortTextDesc"):((order===0)?"sortNumeric":"sortNumericDesc");e="e"+i;if(/Numeric/.test(s)&&tc.headers[c]&&tc.headers[c].string){for(j=0;j<lc;j++){col=Math.abs(parseFloat(d.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}dir=(tc.headers[c])?tc.string[tc.headers[c].string]||0:0}f+="var "+e+" = "+s+"(a["+c+"],b["+c+"],"+mx+","+dir+"); ";f+="if ("+e+") { return "+e+"; } ";f+="else { "}orgOrderCol=(d.normalized&&d.normalized[0])?d.normalized[0].length-1:0;f+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){f+="}; "}f+="return 0; ";f+="}; ";eval(f);d.normalized.sort(sortWrapper);if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time",sortTime)}return d}function sortText(a,b){var c=tbl[0].config,cnt=0,L,t,x;if(a===b){return 0}if(a===''&&c.emptyToBottom!==null){return c.emptyToBottom?1:-1}if(b===''&&c.emptyToBottom!==null){return c.emptyToBottom?-1:1}if(c.sortLocaleCompare){return a.localeCompare(b)}try{x=/^(\.)?\d/;L=Math.min(a.length,b.length)+1;while(cnt<L&&a.charAt(cnt)===b.charAt(cnt)&&x.test(b.substring(cnt))===false&&x.test(a.substring(cnt))===false){cnt++}a=a.substring(cnt);b=b.substring(cnt);if(x.test(a)||x.test(b)){if(x.test(a)===false){return(a)?1:-1}else if(x.test(b)===false){return(b)?-1:1}else{t=parseFloat(a)-parseFloat(b);if(t!==0){return t}else{t=a.search(/[^\.\d]/)}if(t===-1){t=b.search(/[^\.\d]/)}a=a.substring(t);b=b.substring(t)}}return(a>b)?1:-1}catch(er){return 0}}function sortTextDesc(a,b){var c=tbl[0].config;if(a===b){return 0}if(a===''&&c.emptyToBottom!==null){return c.emptyToBottom?1:-1}if(b===''&&c.emptyToBottom!==null){return c.emptyToBottom?-1:1}if(c.sortLocaleCompare){return b.localeCompare(a)}return-sortText(a,b)}function getTextValue(a,b,d){if(b){var i,l=a.length,n=b+d;for(i=0;i<l;i++){n+=a.charCodeAt(i)}return d*n}return 0}function sortNumeric(a,b,e,d){var c=tbl[0].config;if(a===b){return 0}if(a===''&&c.emptyToBottom!==null){return c.emptyToBottom?1:-1}if(b===''&&c.emptyToBottom!==null){return c.emptyToBottom?-1:1}if(isNaN(a)){a=getTextValue(a,e,d)}if(isNaN(b)){b=getTextValue(b,e,d)}return a-b}function sortNumericDesc(a,b,e,d){var c=tbl[0].config;if(a===b){return 0}if(a===''&&c.emptyToBottom!==null){return c.emptyToBottom?1:-1}if(b===''&&c.emptyToBottom!==null){return c.emptyToBottom?-1:1}if(isNaN(a)){a=getTextValue(a,e,d)}if(isNaN(b)){b=getTextValue(b,e,d)}return b-a}this.construct=function(f){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var d,$headers,cache,config,totalRows,$cell,c,i,j,k,a,s,o;this.config={};c=config=$.extend(true,this.config,$.tablesorter.defaults,f);tbl=d=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",c);$headers=buildHeaders(this);c.parsers=buildParserCache(this,$headers);c.string={max:1,'max+':1,'max-':-1,none:0};cache=buildCache(this);fixColumnWidth(this);$headers.click(function(e){totalRows=(d[0].tBodies[0]&&d[0].tBodies[0].rows.length)||0;if(!this.sortDisabled){d.trigger("sortStart",tbl[0]);$cell=$(this);k=!e[c.sortMultiSortKey];this.count=(this.count+1)%(c.sortReset?3:2);if(c.sortRestart){i=this;$headers.each(function(){if(this!==i&&(k||!$(this).is('.'+c.cssDesc+',.'+c.cssAsc))){this.count=-1}})}i=this.column;if(k){c.sortList=[];if(c.sortForce!==null){a=c.sortForce;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}else{if(isValueInArray(i,c.sortList)){for(j=0;j<c.sortList.length;j++){s=c.sortList[j];o=c.headerList[s[0]];if(s[0]===i){s[1]=o.order[o.count];if(s[1]===2){c.sortList.splice(j,1);o.count=-1}}}}else{if(this.order[this.count]<2){c.sortList.push([i,this.order[this.count]])}}}if(c.sortAppend!==null){a=c.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){c.sortList.push(a[j])}}}d.trigger("sortBegin",tbl[0]);setHeadersCss(d[0],$headers,c.sortList);appendToTable(d[0],multisort(d[0],c.sortList,cache));return false}}).mousedown(function(){if(c.cancelSelection){this.onselectstart=function(){return false};return false}});d.bind("update",function(){var t=this,c=t.config;$(c.selectorRemove,t.tBodies[0]).remove();t.config.parsers=buildParserCache(t,$headers);cache=buildCache(t);d.trigger("sorton",[t.config.sortList])}).bind("updateCell",function(e,a){var b=[(a.parentNode.rowIndex-1),a.cellIndex];cache.normalized[b[0]][b[1]]=c.parsers[b[1]].format(getElementText(c,a,b[1]),d,a,b[1]);c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("addRows",function(e,a){var i,rows=a.filter('tr').length,dat=[],l=a[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=c.parsers[j].format(getElementText(c,a[i].cells[j],j),d,a[i].cells[j],j)}dat.push(cache.row.length);cache.row.push([a[i]]);cache.normalized.push(dat);dat=[]}c.cache=cache;d.trigger("sorton",[c.sortList])}).bind("sorton",function(e,a){$(this).trigger("sortStart",tbl[0]);c.sortList=a;var b=c.sortList;updateHeaderSortCount(this,b);setHeadersCss(this,$headers,b);appendToTable(this,multisort(this,b,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,a){getWidgetById(a).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){c.sortList=$(this).metadata().sortlist}applyWidget(this,true);if(c.sortList.length>0){d.trigger("sorton",[c.sortList])}else{applyWidget(this)}this.hasInitialized=true})};this.addParser=function(b){var i,l=g.length,a=true;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===b.id.toLowerCase()){a=false}}if(a){g.push(b)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(s){if(typeof(s)!=='string'){return s}if(tbl[0].config.usNumberFormat){s=s.replace(/,/g,'')}else{s=s.replace(/[\s|\.]/g,'').replace(/,/g,'.')}var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return(/^[\-+]?\d*$/).test($.trim(s.replace(/[,.'\s]/g,'')))};this.clearTableBody=function(a){$(a.tBodies[0]).empty()}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var m=$.tablesorter;m.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});m.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s)},format:function(s){return $.tablesorter.formatFloat(s)},type:"numeric"});m.addParser({id:"currency",is:function(s){return(/^[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9,. \-]/g),""))},type:"numeric"});m.addParser({id:"ipAddress",is:function(s){return(/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2){r+="0"+item}else{r+=item}}return $.tablesorter.formatFloat(r)},type:"numeric"});m.addParser({id:"url",is:function(s){return(/^(https?|ftp|file):\/\/$/).test(s)},format:function(s){return $.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''))},type:"text"});m.addParser({id:"isoDate",is:function(s){return(/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s)},format:function(s){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"")},type:"numeric"});m.addParser({id:"percent",is:function(s){return(/\%$/).test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""))},type:"numeric"});m.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"shortDate",is:function(s){return(/\d{1,4}[\/\-\,\.\s+]\d{1,4}[\/\-\.\,\s+]\d{1,4}/).test(s)},format:function(s,a,b,d){var c=a.config,format=(c.headers&&c.headers[d])?c.headers[d].dateFormat||c.dateFormat:c.dateFormat;s=s.replace(/\s+/g," ").replace(/[\-|\.|\,|\s]/g,"/");if(format==="mmddyyyy"){s=s.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/,"$3/$1/$2")}else if(format==="ddmmyyyy"){s=s.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/,"$3/$2/$1")}else if(format==="yyyymmdd"){s=s.replace(/(\d{4})\/(\d{1,2})\/(\d{1,2})/,"$1/$2/$3")}return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"time",is:function(s){return(/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/).test(s)},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime())},type:"numeric"});m.addParser({id:"metadata",is:function(s){return false},format:function(s,a,b){var c=a.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(b).metadata()[p]},type:"numeric"});m.addWidget({id:"zebra",format:function(a){var b,row=0,even,time,c=a.config,child=c.cssChildRow,css=["even","odd"];css=c.widgetZebra&&c.hasOwnProperty('css')?c.widgetZebra.css:(c.widgetOptions&&c.widgetOptions.hasOwnProperty('zebra'))?c.widgetOptions.zebra:css;if(a.config.debug){time=new Date()}$("tr:visible",a.tBodies[0]).each(function(){b=$(this);if(!b.hasClass(child)){row++}even=(row%2===0);b.removeClass(css[even?1:0]).addClass(css[even?0:1])});if(a.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "tablesorter",
- "version": "2.1.10",
+ "version": "2.1.11",
"title": "tablesorter",
"author": {
"name": "Christian Bach",

0 comments on commit 566315a

Please sign in to comment.
Something went wrong with that request. Please try again.