From 7ca39974e75b0ad2da70cdc971d2abf4f6c79044 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Sun, 31 Jul 2011 22:15:17 -0500 Subject: [PATCH] deal with strings in numeric sorts --- README.markdown | 29 +-- changelog.markdown => changelog.txt | 10 + docs/css/jq.css | 3 + docs/example-option-digits.html | 4 +- ...xample-options-headers-digits-strings.html | 213 ++++++++++++++++++ docs/example-ui-theme.html | 4 +- docs/index.html | 33 ++- js/jquery.tablesorter.js | 91 +++++--- js/jquery.tablesorter.min.js | 4 +- 9 files changed, 324 insertions(+), 67 deletions(-) rename changelog.markdown => changelog.txt (83%) create mode 100644 docs/example-options-headers-digits-strings.html diff --git a/README.markdown b/README.markdown index 7ca143f3..3007d032 100644 --- a/README.markdown +++ b/README.markdown @@ -26,7 +26,17 @@ Included all original [document pages](http://mottie.github.com/tablesorter/docs ###Change Log -View the [complete listing here](http://mottie.github.com/tablesorter/changelog.markdown). +View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt). + +#### 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) @@ -50,20 +60,3 @@ View the [complete listing here](http://mottie.github.com/tablesorter/changelog. * 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. diff --git a/changelog.markdown b/changelog.txt similarity index 83% rename from changelog.markdown rename to changelog.txt index ae6fee45..1ebde67f 100644 --- a/changelog.markdown +++ b/changelog.txt @@ -1,5 +1,15 @@ ###TableSorter Change Log +#### 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: diff --git a/docs/css/jq.css b/docs/css/jq.css index b807beec..7ff01f9b 100644 --- a/docs/css/jq.css +++ b/docs/css/jq.css @@ -9,6 +9,9 @@ h2{color:#333;font-size:small;font-weight:400;margin:0;} table.info{border:#000 1px solid;border-collapse:collapse;margin:10px 0 0 10px;} table.tablesorter table.info tbody th,table.tablesorter table.info tbody td{border:#000 1px solid;} table.tablesorter table.info tbody th{background:#eee;} +#options{width:100%;} +#options pre{width:95%;} +#options .examples{width:60px;} pre,#display{overflow-x:auto;padding:15px;border:1px solid #ddd;border-left-width:5px;} pre,#display,code.hilight{background-color:#eee;color:#333;font-size:small;list-style:none;} a code.hilight {text-decoration:underline;} diff --git a/docs/example-option-digits.html b/docs/example-option-digits.html index 35e90991..42748001 100644 --- a/docs/example-option-digits.html +++ b/docs/example-option-digits.html @@ -2,7 +2,7 @@ - jQuery plugin: Tablesorter 2.0 - Enabling debug mode + jQuery plugin: Tablesorter 2.0 - Dealing with Digits @@ -108,7 +108,7 @@

- Next up: Basic: Direction of initial sort ›› + Next up: Basic: Dealing with text strings in numerical sorts ››
diff --git a/docs/example-options-headers-digits-strings.html b/docs/example-options-headers-digits-strings.html new file mode 100644 index 00000000..e6c51cf0 --- /dev/null +++ b/docs/example-options-headers-digits-strings.html @@ -0,0 +1,213 @@ + + + + + jQuery plugin: Tablesorter 2.0 - Dealing with text strings in numerical sorts + + + + + + + + + + + + + + + + + + + +
+ +

+ NOTE! +

+

+ +

Demo

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Account #First NameLast NameAgeDifference5: Ratings (max+)6: Ratings (max-)7: Change (max+)8: Change (max-)9: Change (none)
A43PeterParker28-350101-.1-.1-.1
A255JohnHood33330202N/A #1N/A #1N/A #1
A33ClarkKent1820303N/A #2N/A #2N/A #2
A1BruceAlmighty45-50404-8.4-8.4-8.4
A102BruceEvans22990505-2.2-2.2-2.2
A10JamesSullivan46-1060697.497.497.4
A02BruceCampbell320070723.623.623.6
A55FrankEvans514411.411.411.4
A87JoeSmith2404NRNR5.25.25.2
A012MikeWazowski21-24NRNR
+ +

Javascript

+
+

+	
+

HTML

+
+

+	
+ + + +
+ + + + diff --git a/docs/example-ui-theme.html b/docs/example-ui-theme.html index 353aee97..545b9cdf 100644 --- a/docs/example-ui-theme.html +++ b/docs/example-ui-theme.html @@ -38,8 +38,8 @@ $(table).addClass('ui-widget ui-widget-content ui-corner-all'); $.each(c.headerList, function(){ $(this) - // using new "ui-theme" class in case the user adds their own ui-icon using onRenderHeader - .addClass('ui-state-default ui-corner-all ui-theme') + // using "ui-theme" class in case the user adds their own ui-icon using onRenderHeader + .addClass('ui-widget-header ui-corner-all ui-theme') .append(''); }); } diff --git a/docs/index.html b/docs/index.html index dfdbc4f5..af2354ff 100644 --- a/docs/index.html +++ b/docs/index.html @@ -36,7 +36,7 @@

Author: Christian Bach
- Version: 2.0.9 (changelog)
+ Version: 2.0.10 (changelog)
Licence: Dual licensed under MIT or GPL licenses. @@ -295,6 +295,7 @@

  • Force a default sorting order
  • Append a sort to the selected sorting order
  • Dealing with digits!
  • +
  • Dealing with text strings in numerical sorts New! v2.0.10
  • Direction of initial sort
  • Applying widgets
  • Applying the zebra stripe widget
  • @@ -344,7 +345,7 @@ Type Default Description - Link + Link @@ -508,19 +509,33 @@
    $(function(){
       $("table").tablesorter({
         headers: {
    -      0: { sorter: false },      // disable first column - see Example 1
    -      1: { sorter: "digit" },    // sort second column numerically
    -      2: { sorter: "shortDate" } // sort the fifth column by date (e.g. mm/dd/yyyy if the date format is "us")
    -      3: { lockedOrder: "asc" },  // lock the sort order - this option will not work if added as metadata - see Example 2
    -      4: { sortInitialOrder: "desc" }, // Initial sort order direction of fourth column - see Example 3
    +
    +      // See example - Disable first column
    +      0: { sorter: false },
    +
    +      // See example 2: Sort column numerically & treat any text as if its value is:
    +      1: { sorter: "digit" },                 // zero
    +      2: { sorter: "digit", string: "max+" }, // maximum positive value
    +      3: { sorter: "digit", string: "max-" }, // maximum negative value
    +
    +      // Sort the fifth column by date (e.g. mm/dd/yyyy if the date format is "us")
    +      4: { sorter: "shortDate" }
    +
    +      // See example 3: lock the sort order - this option will not work if added as metadata
    +      5: { lockedOrder: "asc" },
    +
    +      // See Example 4: Initial sort order direction of seventh column
    +      6: { sortInitialOrder: "desc" }
    +
         }
       });
     });
    Ex:1 - 2 - 3 + 2 + 3 + 4 diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index 5fc37e67..085de0ba 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1,6 +1,6 @@ /* * TableSorter 2.0 - Client-side table sorting with ease! -* Version 2.0.9 +* Version 2.0.10 * @requires jQuery v1.2.3 * * Copyright (c) 2007 Christian Bach @@ -20,7 +20,7 @@ * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } }); * @desc Create a tablesorter interface and disableing the first and second column headers. * -* @example $('table').tablesorter({ headers: { 0: {sorter:"integer"}, 1: {sorter:"currency"} } }); +* @example $('table').tablesorter({ headers: { 0: {sorter:"digit"}, 1: {sorter:"currency"} } }); * @desc Create a tablesorter interface and set a column parser for the first and second column. * * @param Object settings An object literal containing key/value pairs to provide optional settings. @@ -483,14 +483,23 @@ /* sorting methods - reverted sorting method back to version 2.0.3 */ function multisort(table,sortList,cache) { var dynamicExp = "var sortWrapper = function(a,b) {", - l = sortList.length, sortTime, i, c, s, e, order, orgOrderCol; - if (table.config.debug) { sortTime = new Date(); } + col, mx = 0, dir = 0, tc = table.config, lc = cache.normalized.length, + l = sortList.length, sortTime, i, j, c, s, e, order, orgOrderCol; + if (tc.debug) { sortTime = new Date(); } for (i=0; i < l; i++) { c = sortList[i][0]; order = sortList[i][1]; - s = (getCachedSortType(table.config.parsers,c) === "text") ? ((order === 0) ? "sortText" : "sortTextDesc") : ((order === 0) ? "sortNumeric" : "sortNumericDesc"); + s = (getCachedSortType(tc.parsers,c) === "text") ? ((order === 0) ? "sortText" : "sortTextDesc") : ((order === 0) ? "sortNumeric" : "sortNumericDesc"); e = "e" + i; - dynamicExp += "var " + e + " = " + s + "(a[" + c + "],b[" + c + "]); "; + // get max column value (ignore sign) + if (/Numeric/.test(s) && tc.headers[c] && tc.headers[c].string){ + for (j=0; j < lc; j++) { + col = Math.abs(parseFloat(cache.normalized[j][c])); + mx = Math.max( mx, isNaN(col) ? 0 : col ); + } + dir = (tc.headers[c]) ? tc.string[tc.headers[c].string] || 0 : 0; + } + dynamicExp += "var " + e + " = " + s + "(a[" + c + "],b[" + c + "]," + mx + "," + dir + "); "; dynamicExp += "if (" + e + ") { return " + e + "; } "; dynamicExp += "else { "; } @@ -504,11 +513,11 @@ dynamicExp += "}; "; eval(dynamicExp); cache.normalized.sort(sortWrapper); - if (table.config.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time:", sortTime); } + if (tc.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time:", sortTime); } return cache; } - // http://www.webdeveloper.com/forum/showthread.php?t=107909 + // Natural sort modified from: http://www.webdeveloper.com/forum/showthread.php?t=107909 function sortText(a, b) { if ($.data(tbl[0], "tablesorter").sortLocaleCompare) { return a.localeCompare(b); } if (a === b) { return 0; } @@ -537,16 +546,36 @@ } } - function sortTextDesc(a,b){ + function sortTextDesc(a, b){ if ($.data(tbl[0], "tablesorter").sortLocaleCompare) { return b.localeCompare(a); } - return -sortText(a,b); + return -sortText(a, b); } - function sortNumeric(a, b) { + // return text string value by adding up ascii value + // so the text is somewhat sorted when using a digital sort + // this is NOT an alphanumeric sort + function getTextValue(a, mx, d){ + if (a === '') { return (d || 0) * Number.MAX_VALUE; } + if (mx) { + // make sure the text value is greater than the max numerical value (mx) + var i, l = a.length, n = mx + d; + for (i = 0; i < l; i++){ + n += a.charCodeAt(i); + } + return d * n; + } + return 0; + } + + function sortNumeric(a, b, mx, d) { + if (a === '' || isNaN(a)) { a = getTextValue(a, mx, d); } + if (b === '' || isNaN(b)) { b = getTextValue(b, mx, d); } return a - b; } - function sortNumericDesc(a, b) { + function sortNumericDesc(a, b, mx, d) { + if (a === '' || isNaN(a)) { a = getTextValue(a, mx, d); } + if (b === '' || isNaN(b)) { b = getTextValue(b, mx, d); } return b - a; } @@ -570,6 +599,8 @@ $headers = buildHeaders(this); // try to auto detect column type, and store in tables config this.config.parsers = buildParserCache(this, $headers); + // digit sort text location + this.config.string = { max: 1, 'max+': 1, 'max-': -1, none: 0 }; // build the cache for the tbody cells cache = buildCache(this); // get the css class names, could be done else where. @@ -662,8 +693,7 @@ var me = this; setTimeout(function(){ // rebuild parsers. - me.config.parsers = buildParserCache( - me, $headers); + me.config.parsers = buildParserCache(me, $headers); // rebuild the cache map cache = buildCache(me); }, 1); @@ -673,8 +703,7 @@ // get position from the dom. pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex]; // update cache - cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format( - getElementText(config, cell), cell); + cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(getElementText(config, cell), cell); }) .bind("sorton", function(e, list) { $(this).trigger("sortStart", tbl[0]); @@ -723,16 +752,13 @@ this.addWidget = function (widget) { widgets.push(widget); }; - this.formatFloat = function (s) { + this.formatFloat = function(s) { var i = parseFloat(s); - return (isNaN(i)) ? 0 : i; + // return the text instead of zero + return isNaN(i) ? $.trim(s) : i; }; - this.formatInt = function (s) { - var i = parseInt(s, 10); - return (isNaN(i)) ? 0 : i; - }; - this.isDigit = function (s, config) { - // replace all an wanted chars and match. + this.isDigit = function(s) { + // replace all unwanted chars and match. return (/^[\-+]?\d*$/).test($.trim(s.replace(/[,.']/g, ''))); }; this.clearTableBody = function (table) { @@ -772,12 +798,11 @@ ts.addParser({ id: "digit", - is: function(s, table){ - var c = table.config; - return $.tablesorter.isDigit(s.replace(/,/g, ""), c); // isDigit(s, c); + is: function(s){ + return $.tablesorter.isDigit(s.replace(/,/g, "")); }, format: function(s){ - return $.tablesorter.formatFloat(s.replace(/,/g, "")); // formatFloat(s); + return $.tablesorter.formatFloat(s.replace(/,/g, "")); }, type: "numeric" }); @@ -788,7 +813,7 @@ return (/^[£$€¤¥¢?.]/).test(s); }, format: function(s){ - return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.\-]/g), "")); // RegExp(/[£$€]/g), "")); + return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.\-]/g), "")); }, type: "numeric" }); @@ -831,9 +856,8 @@ 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() : "0"); + format: function(s) { + return $.tablesorter.formatFloat((s !== "") ? new Date(s.replace(new RegExp(/-/g), "/")).getTime() : "0"); }, type: "numeric" }); @@ -918,8 +942,7 @@ // loop through the visible rows $("tr:visible", table.tBodies[0]).each(function (i) { $tr = $(this); - // style children rows the same way the parent - // row was styled + // style children rows the same way the parent row was styled if (!$tr.hasClass(table.config.cssChildRow)) { row++; } odd = (row % 2 === 0); $tr diff --git a/js/jquery.tablesorter.min.js b/js/jquery.tablesorter.min.js index c3a3ae17..4a4eac91 100644 --- a/js/jquery.tablesorter.min.js +++ b/js/jquery.tablesorter.min.js @@ -1,7 +1,7 @@ /* * TableSorter 2.0 - Client-side table sorting with ease! -* Version 2.0.9 +* Version 2.0.10 * Copyright (c) 2007 Christian Bach */ -(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",onRenderHeader:null,selectorHeaders:"thead th", tableClass:"tablesorter",debug:false};function log(s){if(typeof console!=="undefined"&&typeof console.debug!=="undefined")console.log(s);else alert(s)}function benchmark(s,d){log(s+","+((new Date).getTime()-d.getTime())+"ms")}this.benchmark=benchmark;function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction==="simple")if(config.supportsTextContent)text=node.textContent;else if(node.childNodes[0]&& node.childNodes[0].hasChildNodes())text=node.childNodes[0].innerHTML;else text=node.innerHTML;else if(typeof config.textExtraction==="function")text=config.textExtraction(node);else text=$(node).text();return text}function getParserById(name){var i,l=parsers.length;for(i=0;i").each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(table,index));this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table, index))this.sortDisabled=true;this.lockedOrder=false;lock=checkHeaderLocked(table,index);if(typeof lock!=="undefined"&&lock!==false)this.order=this.lockedOrder=formatSortingOrder(lock);if(!this.sortDisabled){$th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th,[index])}table.config.headerList[index]=this});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(table,rows, row){var i,cell,arr=[],r=table.tHead.rows,c=r[row].cells;for(i=0;i1)arr=arr.concat(checkCellColSpan(table,rows,row++));else if(table.tHead.length===1||cell.rowSpan>1||!r[row+1])arr.push(cell)}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i");$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($("").css("width",$(this).width()))});$(table).prepend(colgroup)}}function updateHeaderSortCount(table,sortList){var i,s,o,c=table.config,l=sortList.length;for(i=0;ib?1:-1}catch(er){return 0}}function sortTextDesc(a, b){if($.data(tbl[0],"tablesorter").sortLocaleCompare)return b.localeCompare(a);return-sortText(a,b)}function sortNumeric(a,b){return a-b}function sortNumericDesc(a,b){return b-a}this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder,sortCSS,totalRows,$cell,i,j,a,s,o;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);tbl=$this=$(this).addClass(this.config.tableClass); $.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){totalRows=$this[0].tBodies[0]&&$this[0].tBodies[0].rows.length||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart",tbl[0]);$cell=$(this);i=this.column;this.order=this.count++%2;if(typeof this.lockedOrder!=="undefined"&&this.lockedOrder!==false)this.order=this.lockedOrder; if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!==null){a=config.sortForce;for(j=0;j0)$this.trigger("sorton",[config.sortList]);applyWidget(this)})};this.addParser=function(parser){var i,l=parsers.length,a=true;for(i=0;i").each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(table,index));this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table, index))this.sortDisabled=true;this.lockedOrder=false;lock=checkHeaderLocked(table,index);if(typeof lock!=="undefined"&&lock!==false)this.order=this.lockedOrder=formatSortingOrder(lock);if(!this.sortDisabled){$th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th,[index])}table.config.headerList[index]=this});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(table,rows, row){var i,cell,arr=[],r=table.tHead.rows,c=r[row].cells;for(i=0;i1)arr=arr.concat(checkCellColSpan(table,rows,row++));else if(table.tHead.length===1||cell.rowSpan>1||!r[row+1])arr.push(cell)}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i");$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($("").css("width",$(this).width()))});$(table).prepend(colgroup)}}function updateHeaderSortCount(table,sortList){var i,s,o,c=table.config,l=sortList.length;for(i=0;ib?1:-1}catch(er){return 0}}function sortTextDesc(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare)return b.localeCompare(a);return-sortText(a,b)}function getTextValue(a,mx,d){if(a==="")return(d||0)*Number.MAX_VALUE;if(mx){var i,l=a.length,n=mx+d;for(i=0;i0){$this.trigger("sortStart",tbl[0]);$cell=$(this);i=this.column; this.order=this.count++%2;if(typeof this.lockedOrder!=="undefined"&&this.lockedOrder!==false)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!==null){a=config.sortForce;for(j=0;j0)$this.trigger("sorton",[config.sortList]);applyWidget(this)})};this.addParser=function(parser){var i,l=parsers.length,a=true;for(i=0;i