diff --git a/README.markdown b/README.markdown index fa663588..08b8957e 100644 Binary files a/README.markdown and b/README.markdown differ diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index a6327ee4..36352b41 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -1,6 +1,6 @@ /*! * tablesorter pager plugin - * updated 5/23/2012 + * updated 5/28/2012 */ ;(function($) { $.extend({tablesorterPager: new function() { @@ -235,6 +235,7 @@ if (e > rows.length ) { e = rows.length; } + $(table.tBodies[0]).addClass('tablesorter-hidden'); $.tablesorter.clearTableBody(table); for (i = s; i < e; i++) { o = rows[i]; @@ -244,6 +245,7 @@ } } table.tBodies[0].appendChild(f); + $(table.tBodies[0]).removeClass('tablesorter-hidden'); } if ( c.page >= c.totalPages ) { moveToLastPage(table, c); diff --git a/addons/pager/jquery.tablesorter.pager.min.js b/addons/pager/jquery.tablesorter.pager.min.js index 87575cfa..f6570274 100644 --- a/addons/pager/jquery.tablesorter.pager.min.js +++ b/addons/pager/jquery.tablesorter.pager.min.js @@ -1,2 +1,2 @@ -/*! tablesorter pager plugin minified - updated 5/11/2012 */ -;(function(d){d.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,fixedHeight:!1,removeRows:!0,cssNext:".next",cssPrev:".prev",cssFirst:".first",cssLast:".last",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssDisabled:"disabled",totalRows:0,totalPages:0};var o=this,p=function(c,b){var a=c.cssDisabled,e=!!b;c.updateArrows&&(c.container[c.totalRows< c.size?"addClass":"removeClass"](a),d(c.cssFirst+","+c.cssPrev,c.container)[e||0===c.page?"addClass":"removeClass"](a),d(c.cssNext+","+c.cssLast,c.container)[e||c.page===c.totalPages-1?"addClass":"removeClass"](a))},t=function(c,b){if(0')},l=function(c,b){var a, e=d("tr:not(."+c.config.cssChildRow+")",c.tBodies),g=e.length,f=b.page*b.size,i=f+b.size;i>g&&(i=g);for(a=0;a=f&&a'+(e?e.message+" ("+e.name+")":"No rows found")+"",l=a.ajaxProcessing(c)||[0,[]],n=l[1]||[],q=n.length,r=l[2];if(0";for(g=0;g"+n[c][g]+"";m+=""}r&&r.length===o&&(f=h.hasClass("hasStickyHeaders"),j=h.find("."+(a.widgetOptions&&a.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),i=h.find("tfoot tr:first").children(),h.find("thead tr.tablesorter-header th").each(function(a){var b= d(this),b=b.find("span").length?b.find("span:first"):b;b.html(r[a]);i.eq(a).html(r[a]);f&&j.length&&(b=j.find("th").eq(a),b=b.find("span").length?b.find("span:first"):b,b.html(r[a]))}));e?h.find("thead").append(p):k.html(m);a.temp.remove();h.trigger("update");a.totalRows=l[0]||0;a.totalPages=Math.ceil(a.totalRows/a.size);t(b,a);s(b,a);h.trigger("pagerChange",a)}},v=function(c,b){var a=d(c),e=b.ajaxUrl.replace(/\{page\}/g,b.page).replace(/\{size\}/g,b.size);""!==e&&(b.temp=d("
",{id:"tablesorterPagerLoading", width:a.outerWidth(!0),height:a.outerHeight(!0)}),a.before(b.temp),d(document).ajaxError(function(a,d,e,j){u(null,c,b,j)}),d.getJSON(e,function(a){u(a,c,b)}))},n=function(c,b,a){var e,g,f,i=document.createDocumentFragment(),j=b.length;e=a.page*a.size;var h=e+a.size;if(!(1>j)){d(c).trigger("pagerChange",a);if(a.removeRows){h>b.length&&(h=b.length);for(d.tablesorter.clearTableBody(c);e=a.totalPages&& (a.page=a.totalPages-1,k(c,a));t(c,a);a.isDisabled||s(c,a);d(c).trigger("applyWidgets")}},w=function(c,b){b.ajax?p(b,!0):(b.isDisabled=!0,d.data(c,"pagerLastPage",b.page),d.data(c,"pagerLastSize",b.size),b.page=0,b.size=b.totalRows,b.totalPages=1,d("tr.pagerSavedHeightSpacer",c.tBodies[0]).remove(),n(c,c.config.rowsCopy,b));d(b.cssPageSize,b.container).addClass(b.cssDisabled)[0].disabled=!0},k=function(c,b){if(!b.isDisabled){if(0>b.page||b.page>b.totalPages-1)b.page=0;d.data(c,"pagerLastPage",b.page); b.ajax?v(c,b):n(c,c.config.rowsCopy,b)}},x=function(c,b,a){a.size=b;d.data(c,"pagerLastPage",a.page);d.data(c,"pagerLastSize",a.size);a.totalPages=Math.ceil(a.totalRows/a.size);k(c,a)},y=function(c,b,a){var e=d(b.cssPageSize,b.container).removeClass(b.cssDisabled).removeAttr("disabled");b.isDisabled=!1;b.page=d.data(c,"pagerLastPage")||b.page||0;b.size=d.data(c,"pagerLastSize")||parseInt(e.val(),10)||b.size;b.totalPages=Math.ceil(b.totalRows/b.size);a&&(d(c).trigger("update"),x(c,b.size,b),q(c,b), s(c,b))};o.appender=function(c,b){var a=c.config.pager;a.ajax||(c.config.rowsCopy=b,a.totalRows=b.length,a.size=d.data(c,"pagerLastSize")||a.size,a.totalPages=Math.ceil(a.totalRows/a.size),n(c,b,a))};o.construct=function(c){return this.each(function(){var b=this.config,a=b.pager=d.extend({},d.tablesorterPager.defaults,c),e=this,g=d(e),f=d(a.container).show();b.appender=o.appender;y(e,a,!1);"string"===typeof a.ajaxUrl?(a.ajax=!0,v(e,a)):(a.ajax=!1,d(this).trigger("appendCache"),q(e,a));d(a.cssFirst, f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page=0;k(e,a)}return false});d(a.cssNext,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page++;if(a.page>=a.totalPages-1)a.page=a.totalPages-1;k(e,a)}return false});d(a.cssPrev,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page--;if(a.page<=0)a.page=0;k(e,a)}return false});d(a.cssLast,f).unbind("click.pager").bind("click.pager", function(){if(!d(this).hasClass(a.cssDisabled)){a.page=a.totalPages-1;k(e,a)}return false});d(a.cssPageSize,f).unbind("change.pager").bind("change.pager",function(){d(a.cssPageSize,f).val(d(this).val());if(!d(this).hasClass(a.cssDisabled)){x(e,parseInt(d(this).val(),10),a);var b=d(e.tBodies[0]);b.find("tr.pagerSavedHeightSpacer").remove();d.data(e,"pagerSavedHeight",b.height());s(e,a);d.data(e,"pagerLastSize",a.size)}return false});g.unbind("disable.pager enable.pager destroy.pager").bind("disable.pager", function(){w(e,a)}).bind("enable.pager",function(){y(e,a,true)}).bind("destroy.pager",function(){w(e,a);a.container.hide();e.config.appender=null;d(e).unbind("destroy.pager sortEnd.pager enable.pager disable.pager")})})}}});d.fn.extend({tablesorterPager:d.tablesorterPager.construct})})(jQuery); +/*! tablesorter pager plugin minified - updated 5/28/2012 */ +;(function(d){d.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,fixedHeight:!1,removeRows:!0,cssNext:".next",cssPrev:".prev",cssFirst:".first",cssLast:".last",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssDisabled:"disabled",totalRows:0,totalPages:0};var o=this,p=function(c,b){var a=c.cssDisabled,e=!!b;c.updateArrows&&(c.container[c.totalRows< c.size?"addClass":"removeClass"](a),d(c.cssFirst+","+c.cssPrev,c.container)[e||0===c.page?"addClass":"removeClass"](a),d(c.cssNext+","+c.cssLast,c.container)[e||c.page===c.totalPages-1?"addClass":"removeClass"](a))},t=function(c,b){if(0')},l=function(c,b){var a, e=d("tr:not(."+c.config.cssChildRow+")",c.tBodies),g=e.length,f=b.page*b.size,i=f+b.size;i>g&&(i=g);for(a=0;a=f&&a'+(e?e.message+" ("+e.name+")":"No rows found")+"",l=a.ajaxProcessing(c)||[0,[]],n=l[1]||[],q=n.length,r=l[2];if(0";for(g=0;g"+n[c][g]+"";m+=""}r&&r.length===o&&(f=h.hasClass("hasStickyHeaders"),j=h.find("."+(a.widgetOptions&&a.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),i=h.find("tfoot tr:first").children(),h.find("thead tr.tablesorter-header th").each(function(a){var b= d(this),b=b.find("span").length?b.find("span:first"):b;b.html(r[a]);i.eq(a).html(r[a]);f&&j.length&&(b=j.find("th").eq(a),b=b.find("span").length?b.find("span:first"):b,b.html(r[a]))}));e?h.find("thead").append(p):k.html(m);a.temp.remove();h.trigger("update");a.totalRows=l[0]||0;a.totalPages=Math.ceil(a.totalRows/a.size);t(b,a);s(b,a);h.trigger("pagerChange",a)}},v=function(c,b){var a=d(c),e=b.ajaxUrl.replace(/\{page\}/g,b.page).replace(/\{size\}/g,b.size);""!==e&&(b.temp=d("
",{id:"tablesorterPagerLoading", width:a.outerWidth(!0),height:a.outerHeight(!0)}),a.before(b.temp),d(document).ajaxError(function(a,d,e,j){u(null,c,b,j)}),d.getJSON(e,function(a){u(a,c,b)}))},n=function(c,b,a){var e,g,f,i=document.createDocumentFragment(),j=b.length;e=a.page*a.size;var h=e+a.size;if(!(1>j)){d(c).trigger("pagerChange",a);if(a.removeRows){h>b.length&&(h=b.length);d(c.tBodies[0]).addClass("tablesorter-hidden");for(d.tablesorter.clearTableBody(c);e=a.totalPages&&(a.page=a.totalPages-1,k(c,a));t(c,a);a.isDisabled||s(c,a);d(c).trigger("applyWidgets")}},w=function(c,b){b.ajax?p(b,!0):(b.isDisabled=!0,d.data(c,"pagerLastPage",b.page),d.data(c,"pagerLastSize",b.size),b.page=0,b.size=b.totalRows,b.totalPages=1,d("tr.pagerSavedHeightSpacer",c.tBodies[0]).remove(),n(c,c.config.rowsCopy,b));d(b.cssPageSize,b.container).addClass(b.cssDisabled)[0].disabled=!0},k=function(c,b){if(!b.isDisabled){if(0> b.page||b.page>b.totalPages-1)b.page=0;d.data(c,"pagerLastPage",b.page);b.ajax?v(c,b):n(c,c.config.rowsCopy,b)}},x=function(c,b,a){a.size=b;d.data(c,"pagerLastPage",a.page);d.data(c,"pagerLastSize",a.size);a.totalPages=Math.ceil(a.totalRows/a.size);k(c,a)},y=function(c,b,a){var e=d(b.cssPageSize,b.container).removeClass(b.cssDisabled).removeAttr("disabled");b.isDisabled=!1;b.page=d.data(c,"pagerLastPage")||b.page||0;b.size=d.data(c,"pagerLastSize")||parseInt(e.val(),10)||b.size;b.totalPages=Math.ceil(b.totalRows/ b.size);a&&(d(c).trigger("update"),x(c,b.size,b),q(c,b),s(c,b))};o.appender=function(c,b){var a=c.config.pager;a.ajax||(c.config.rowsCopy=b,a.totalRows=b.length,a.size=d.data(c,"pagerLastSize")||a.size,a.totalPages=Math.ceil(a.totalRows/a.size),n(c,b,a))};o.construct=function(c){return this.each(function(){var b=this.config,a=b.pager=d.extend({},d.tablesorterPager.defaults,c),e=this,g=d(e),f=d(a.container).show();b.appender=o.appender;y(e,a,!1);"string"===typeof a.ajaxUrl?(a.ajax=!0,v(e,a)):(a.ajax= !1,d(this).trigger("appendCache",!0),q(e,a));d(a.cssFirst,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page=0;k(e,a)}return false});d(a.cssNext,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page++;if(a.page>=a.totalPages-1)a.page=a.totalPages-1;k(e,a)}return false});d(a.cssPrev,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page--;if(a.page<=0)a.page=0;k(e, a)}return false});d(a.cssLast,f).unbind("click.pager").bind("click.pager",function(){if(!d(this).hasClass(a.cssDisabled)){a.page=a.totalPages-1;k(e,a)}return false});d(a.cssPageSize,f).unbind("change.pager").bind("change.pager",function(){d(a.cssPageSize,f).val(d(this).val());if(!d(this).hasClass(a.cssDisabled)){x(e,parseInt(d(this).val(),10),a);var b=d(e.tBodies[0]);b.find("tr.pagerSavedHeightSpacer").remove();d.data(e,"pagerSavedHeight",b.height());s(e,a);d.data(e,"pagerLastSize",a.size)}return false}); g.unbind("disable.pager enable.pager destroy.pager").bind("disable.pager",function(){w(e,a)}).bind("enable.pager",function(){y(e,a,true)}).bind("destroy.pager",function(){w(e,a);a.container.hide();e.config.appender=null;d(e).unbind("destroy.pager sortEnd.pager enable.pager disable.pager")})})}}});d.fn.extend({tablesorterPager:d.tablesorterPager.construct})})(jQuery); diff --git a/css/blue/blue.zip b/css/blue/blue.zip index e087b93e..90f259fa 100644 Binary files a/css/blue/blue.zip and b/css/blue/blue.zip differ diff --git a/css/blue/style.css b/css/blue/style.css index e403b28b..ff5d281c 100644 --- a/css/blue/style.css +++ b/css/blue/style.css @@ -59,6 +59,10 @@ table.tablesorter th.tablesorter-headerSortDown { /* image */ /* background-image: url(black-desc.gif); */ } +/* used to hide a tbody while rebuilding to speed it up */ +table.tablesorter .tablesorter-hidden { + display: none; +} /* Zebra Widget - row alternating colors */ table.tablesorter tr.odd td { diff --git a/css/green/green.zip b/css/green/green.zip index 2285fb83..f902ac4d 100644 Binary files a/css/green/green.zip and b/css/green/green.zip differ diff --git a/css/green/style.css b/css/green/style.css index daddd890..1df236f2 100644 --- a/css/green/style.css +++ b/css/green/style.css @@ -48,6 +48,10 @@ table.tablesorter th.headerSortDown span:first-child, table.tablesorter th.tablesorter-headerSortDown .tablesorter-header-inner { background: url(desc.png) no-repeat; } +/* used to hide a tbody while rebuilding to speed it up */ +table.tablesorter .tablesorter-hidden { + display: none; +} /* Zebra Widget - row alternating colors */ table.tablesorter tr.odd td { diff --git a/css/ui/style.css b/css/ui/style.css index d76c30e6..ea0084f0 100644 --- a/css/ui/style.css +++ b/css/ui/style.css @@ -40,6 +40,10 @@ table.tablesorter tbody td { table.tablesorter tr.ui-state-default { background-image: url(); } +/* used to hide a tbody while rebuilding to speed it up */ +table.tablesorter .tablesorter-hidden { + display: none; +} /* filter widget */ table.tablesorter thead tr.tablesorter-filter input.tablesorter-filter { diff --git a/docs/example-widget-resizable.html b/docs/example-widget-resizable.html index 206ead7c..0dfe9a4a 100644 --- a/docs/example-widget-resizable.html +++ b/docs/example-widget-resizable.html @@ -48,6 +48,7 @@
  • This widget can be applied to the original plugin. The code is in the "jquery.tablesorter.widgets.js" file.
  • This widget now saves all changed column widths to local storage, or it falls back to a cookie! New! v2.1
  • Column width saving requires the new "$.tablesorter.storage()" function included with the "jquery.tablesorter.widgets.js" file. New! v2.1
  • +
  • Fixed the issue where resizing a column would cause a sort of the column to the right in v2.3.5.
  • Because this widget uses jQuery's closest() function, it requires jQuery 1.3+ in order to work.
  • Because this widget uses jQuery's parseJson() function, it requires jQuery version 1.4.1+ in order to save the widths.
  • diff --git a/docs/example-widgets.html b/docs/example-widgets.html index ea59a1c7..e5355544 100644 --- a/docs/example-widgets.html +++ b/docs/example-widgets.html @@ -31,9 +31,10 @@ // format is called when the on init and when a sorting has finished format: function(table) { + var h, i, skip; // cache and collect all TH headers if (!this.headers) { - var h = this.headers = []; + h = this.headers = []; $("thead th",table).each(function() { h.push( "" + $(this).text() + "" @@ -44,18 +45,17 @@ // remove appended headers by classname $("tr.repeated-header",table).remove(); + // number of rows to skip + skip = 4; + // loop all tr elements and insert a copy of the "headers" - for (var i = 0; i < table.tBodies[0].rows.length; i++) { + for (i = skip; i < table.tBodies[0].rows.length; i += (skip + 1)) { // insert a copy of the table head every X rows - // i mod 5 = 4, is true every 4th row, starting from the 4th. - // i mod 6 = 5, is true every 5th row, starting from the 5th, etc. - if ((i%5) === 4) { - $("tbody tr:eq(" + i + ")",table).before( - // "remove-me" class was added in case the table needs to be updated, the "remove-me" rows will be - // removed prior to the update to prevent including the rows in the update - see "selectorRemove" option - $("").addClass("repeated-header remove-me").html(this.headers.join("")) - ); - } + $("tbody tr:eq(" + i + ")",table).before( + // "remove-me" class was added in case the table needs to be updated, the "remove-me" rows will be + // removed prior to the update to prevent including the rows in the update - see "selectorRemove" option + $("").addClass("repeated-header remove-me").html(this.headers.join("")) + ); } } @@ -312,6 +312,15 @@ 80 80 + + Student24 + Languages + female + 100 + 91 + 13 + 82 + diff --git a/docs/index.html b/docs/index.html index 3524f243..b5346472 100644 --- a/docs/index.html +++ b/docs/index.html @@ -690,7 +690,7 @@
    $(function(){
       $("table").tablesorter({
         onRenderHeader: function (){
    -      $(this).find('span').addClass('roundedCorners');
    +      $(this).find('div').addClass('roundedCorners');
         }
       });
     });
    and you'll end up with this HTML (only the thead is shown)
    <thead>
    @@ -1282,7 +1282,7 @@ $(function(){
     				Boolean
     				false
     				
    -					Filter widget: Set this option to true to use the filter to find text from the start of the column, so typing in "a" will find "albert" but not "frank", both have a's. (New v2.1).
    +					Set this option to true to use the filter to find text from the start of the column, so typing in "a" will find "albert" but not "frank", both have a's. (New v2.1).
     					

    Use the filter_startsWith option as follows: @@ -1298,6 +1298,58 @@ $(function(){ Example + + filter_ignoreCase + Boolean + true + + Set this option to false to make the column content search case-insensitive, so typing in "a" will not find "Albert". New! v2.3.4 +
    +
    + Use the filter_ignorecase option as follows: +
    $(function(){
    +  $("table").tablesorter({
    +    widgets: ["filter"],
    +    widgetOptions : {
    +      filter_ignoreCase : false
    +    }
    +  });
    +});
    + + Example + + + + + filter_searchDelay + Numeric + 300 + + Set this option to the number of milliseconds to delay the search. New! v2.3.4 +
    +
    + Use the filter_searchDelay option as follows: +
    $(function(){
    +  $("table").tablesorter({
    +    widgets: ["filter"],
    +    widgetOptions : {
    +      filter_searchDelay : 500
    +    }
    +  });
    +});
    + + If you want to want to initialize the filter without user input, target any one of the filters and trigger a "search". + +
    // target the first filter input
    +// this method will begin the search after the searchDelay time
    +$('input.tablesorter-filter:eq(0)').trigger('search');
    +
    +// this method will begin the search immediately
    +$('input.tablesorter-filter:eq(0)').trigger('search', false);
    + + + + stickyHeaders String diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index 81650521..b8109ff3 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -24,7 +24,7 @@ this.defaults = { // appearance - widthFixed : false, + widthFixed : false, // adds colgroup to fix widths of columns // functionality cancelSelection : true, // prevent text selection in the header @@ -51,6 +51,7 @@ textSorter : null, // use custom text sorter - function(a,b){ return a.sort(b); } // basic sort // widget options + widgets: [], // method to add widgets, e.g. widgets: ['zebra'] widgetOptions : { zebra : [ "even", "odd" ] // zebra widget alternating row class names }, @@ -79,8 +80,7 @@ headerList: [], empties: {}, strings: {}, - parsers: [], - widgets: [] + parsers: [] // deprecated; but retained for backwards compatibility // widgetZebra: { css: ["even", "odd"] } @@ -104,17 +104,26 @@ this.hasInitialized = false; function getElementText(table, node, cellIndex) { - var text = "", t = table.config.textExtraction; if (!node) { return ""; } + var c = table.config, + t = c.textExtraction, text = ""; if (t === "simple") { - text = $(node).text(); + if (c.supportsTextContent) { + text = node.textContent; // newer browsers support this + } else { + if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) { + text = node.childNodes[0].innerHTML; + } else { + text = node.innerHTML; + } + } } else { if (typeof(t) === "function") { text = t(node, table, cellIndex); } else if (typeof(t) === "object" && t.hasOwnProperty(cellIndex)) { text = t[cellIndex](node, table, cellIndex); } else { - text = $(node).text(); + text = c.supportsTextContent ? node.textContent : $(node).text(); } } return $.trim(text); @@ -159,11 +168,10 @@ function buildParserCache(table, $headers) { var c = table.config, - $tb = $(table.tBodies).filter(':not(.' + c.cssInfoBlock + ')'), - $f = $(document.createDocumentFragment()), - ts = $.tablesorter, rows, list, l, i, h, ch, p, parsersDebug = ""; - if ( $tb.length === 0) { return; } // In the case of empty tables - rows = $tb.children('tr').clone().appendTo($f); + tb = $(table.tBodies).filter(':not(.' + c.cssInfoBlock + ')'), + ts = $.tablesorter, rows, list, l, i, h, m, ch, cl, p, parsersDebug = ""; + if ( tb.length === 0) { return; } // In the case of empty tables + rows = tb[0].rows; if (rows[0]) { list = []; l = rows[0].cells.length; @@ -221,6 +229,7 @@ tc.cache[k] = { row: [], normalized: [] }; // ignore tbodies with class name from css.cssInfoBlock if (!$(b[k]).hasClass(tc.cssInfoBlock)) { + $(b[k]).addClass('tablesorter-hidden'); totalRows = (b[k] && b[k].rows.length) || 0; totalCells = (b[k].rows[0] && b[k].rows[0].cells.length) || 0; for (i = 0; i < totalRows; ++i) { @@ -243,6 +252,7 @@ cols.push(tc.cache[k].normalized.length); // add position for rowCache tc.cache[k].normalized.push(cols); } + $(b[k]).removeClass('tablesorter-hidden'); } } if (tc.debug) { @@ -261,8 +271,11 @@ } function applyWidget(table, init) { - var c = table.config.widgets, - i, w, l = c.length; + var tc = table.config, c = tc.widgets, + time, i, w, l = c.length; + if (tc.debug) { + time = new Date(); + } for (i = 0; i < l; i++) { w = getWidgetById(c[i]); if ( w ) { @@ -273,6 +286,9 @@ } } } + if (tc.debug) { + benchmark("Completed " + (init === true ? "initializing" : "applying") + " widgets", time); + } } // init flag (true) used by pager plugin to prevent widget application @@ -287,6 +303,7 @@ } for (k = 0; k < b.length; k++) { if (!$(b[k]).hasClass(c.cssInfoBlock)){ + $(b[k]).addClass('tablesorter-hidden'); f = document.createDocumentFragment(); r = c2[k].row; n = c2[k].normalized; @@ -304,6 +321,7 @@ } } table.tBodies[k].appendChild(f); + $(b[k]).removeClass('tablesorter-hidden'); } } if (c.appender) { @@ -366,6 +384,7 @@ return (/^d/i.test(v) || v === 1); } + function buildHeaders(table) { var header_index = computeThIndexes(table), ch, $t, $th, lock, time, $tableHeaders, c = table.config, ts = $.tablesorter; @@ -373,11 +392,12 @@ if (c.debug) { time = new Date(); } - $tableHeaders = $(c.selectorHeaders, table) - .wrapInner("
    ") + $tableHeaders = $(table).find(c.selectorHeaders) .each(function(index) { $t = $(this); ch = c.headers[index]; + this.innerHTML = '
    ' + this.innerHTML + '
    '; // faster than wrapInner + if (c.onRenderHeader) { c.onRenderHeader.apply($th, [index]); } this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex]; this.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2]; this.count = -1; // set to -1 because clicking on the header automatically adds one @@ -389,15 +409,14 @@ } if (!this.sortDisabled) { $th = $t.addClass(c.cssHeader); - if (c.onRenderHeader) { c.onRenderHeader.apply($th, [index]); } } // add cell to headerList c.headerList[index] = this; // add to parent in case there are multiple rows $t.parent().addClass(c.cssHeader); }); - if (c.debug) { - benchmark("Built headers", time); + if (table.config.debug) { + benchmark("Built headers:", time); log($tableHeaders); } return $tableHeaders; @@ -426,7 +445,10 @@ l = list.length; for (i = 0; i < l; i++) { if (list[i][1] === 2) { continue; } // direction = 2 means reset! - h[list[i][0]].addClass(css[list[i][1]]); + if (h[list[i][0]]) { + // add class if cell exists - fix for issue #78 + h[list[i][0]].addClass(css[list[i][1]]); + } // multicolumn sorting updating f = $headers.filter('[data-column="' + list[i][0] + '"]'); if (l > 1 && f.length) { @@ -735,7 +757,6 @@ this.onselectstart = function() { return false; }; - return false; }); } // apply easy methods that trigger binded events @@ -1111,7 +1132,7 @@ ts.addWidget({ id: "zebra", format: function(table) { - var $tb, $tr, $f, row, even, time, k, j, l, + var $tb, $tv, $tr, $f, row, even, time, k, j, l, c = table.config, child = new RegExp(c.cssChildRow, 'i'), b = $(table).children('tbody:not(.' + c.cssInfoBlock + ')'), @@ -1123,23 +1144,23 @@ time = new Date(); } for (k = 0; k < b.length; k++ ) { - row = 0; // loop through the visible rows $tb = $(b[k]); l = $tb.children('tr').length; if (l > 1) { - $f = $(document.createDocumentFragment()); - $tr = $tb.children('tr').appendTo($f); - for (j = 0; j < l; j++) { - if ($tr[j].style.display !== 'none') { - // style children rows the same way the parent row was styled - if (!child.test($tr[j].className)) { row++; } - even = (row % 2 === 0); - $tr.eq(j).removeClass(css[even ? 1 : 0]).addClass(css[even ? 0 : 1]); - } - } + row = 0; + $tv = $tb.find('tr:visible'); + $tb.addClass('tablesorter-hidden'); + // revered back to using jQuery each - strangely it's the fastest method + $tv.each(function(){ + $tr = $(this); + // style children rows the same way the parent row was styled + if (!child.test(this.className)) { row++; } + even = (row % 2 === 0); + $tr.removeClass(css[even ? 1 : 0]).addClass(css[even ? 0 : 1]); + }); + $tb.removeClass('tablesorter-hidden'); } - $tb.append($tr); } if (c.debug) { ts.benchmark("Applying Zebra widget", time); diff --git a/js/jquery.tablesorter.min.js b/js/jquery.tablesorter.min.js index 931724a6..ba6fb481 100644 --- a/js/jquery.tablesorter.min.js +++ b/js/jquery.tablesorter.min.js @@ -1,6 +1,6 @@ /*! -* TableSorter 2.3.4 - Client-side table sorting with ease! +* TableSorter 2.3.5 - Client-side table sorting with ease! * Minified using UglifyJS (http://jscompress.com/) * Copyright (c) 2007 Christian Bach */ -!function($){$.extend({tablesorter:new function(){function log(a){if(typeof console!=="undefined"&&typeof console.log!=="undefined"){console.log(a)}else{alert(a)}}function benchmark(a,b){log(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function getElementText(a,b,c){var d="",e=a.config.textExtraction;if(!b){return""}if(e==="simple"){d=$(b).text()}else{if(typeof e==="function"){d=e(b,a,c)}else if(typeof e==="object"&&e.hasOwnProperty(c)){d=e[c](b,a,c)}else{d=$(b).text()}}return $.trim(d)}function getParserById(a){var b,c=parsers.length;for(b=0;b").each(function(a){e=$(this);d=j.headers[a];this.column=c[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(k.getData(e,d,"sortInitialOrder")||j.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;if(k.getData(e,d,"sorter")==="false"){this.sortDisabled=true}this.lockedOrder=false;g=k.getData(e,d,"lockedOrder")||false;if(typeof g!=="undefined"&&g!==false){this.order=this.lockedOrder=formatSortingOrder(g)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){f=e.addClass(j.cssHeader);if(j.onRenderHeader){j.onRenderHeader.apply(f,[a])}}j.headerList[a]=this;e.parent().addClass(j.cssHeader)});if(j.debug){benchmark("Built headers",h);log(i)}return i}function isValueInArray(a,b){var c,d=b.length;for(c=0;c1&&d.length){for(g=0;g");$("tr:first td",a.tBodies[0]).each(function(){b.append($("").css("width",$(this).width()))});$(a).prepend(b)}}function updateHeaderSortCount(a,b){var c,d,e,f=a.config,g=b.length;for(c=0;ck){return 1}}o=Math.max(h.length,j.length);for(n=0;nm){return 1}}return 0}function sortTextDesc(a,b,c,d){if(b===c){return 0}var e=a.config,f=e.string[e.empties[d]||e.emptyTo];if(b===""&&f!==0){return typeof f==="boolean"?f?-1:1:f||1}if(c===""&&f!==0){return typeof f==="boolean"?f?1:-1:-f||-1}if(typeof e.textSorter==="function"){return e.textSorter(c,b,a,d)}return sortText(a,c,b)}function getTextValue(a,b,c){if(b){var d,e=a.length,f=b+c;for(d=0;d thead th",selectorRemove:"tr.remove-me",debug:false,headerList:[],empties:{},strings:{},parsers:[],widgets:[]};this.benchmark=benchmark;this.hasInitialized=false;this.construct=function(a){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var b,c,d,e,f,g,h,i,j,k,l,m,n=$.metadata;this.config={};g=f=$.extend(true,this.config,$.tablesorter.defaults,a);if(g.debug){$.data(this,"startoveralltimer",new Date)}e=$(this).addClass(g.tableClass);$.data(this,"tablesorter",g);buildRegex();g.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:true,bottom:false};b=buildHeaders(this);g.parsers=buildParserCache(this,b);if(!g.delayInit){buildCache(this)}fixColumnWidth(this);b.click(function(a){if(g.delayInit&&!g.cache){buildCache(e[0])}if(!this.sortDisabled){e.trigger("sortStart",e[0]);c=$(this);j=!a[g.sortMultiSortKey];this.count=(this.count+1)%(g.sortReset?3:2);if(g.sortRestart){h=this;b.each(function(){if(this!==h&&(j||!$(this).is("."+g.cssDesc+",."+g.cssAsc))){this.count=-1}})}h=this.column;if(j){g.sortList=[];if(g.sortForce!==null){k=g.sortForce;for(i=0;i1){for(i=1;i1){for(i=1;i0){e.trigger("sorton",[g.sortList])}else{applyWidget(this)}this.hasInitialized=true;if(g.debug){$.tablesorter.benchmark("Overall initialization time",$.data(this,"startoveralltimer"))}e.trigger("tablesorter-initialized",this);if(typeof g.initialized==="function"){g.initialized(this)}})};this.destroy=function(a,b){var c=$(a),d=a.config;c.find("thead:first tr:not(."+d.cssHeader+")").remove();c.find("thead:first .tablesorter-resizer").remove();c.unbind("update updateCell addRows sorton appendCache applyWidgetId applyWidgets destroy mouseup mouseleave").find(d.selectorHeaders).unbind("click mousedown mousemove mouseup").removeClass(d.cssHeader+" "+d.cssAsc+" "+d.cssDesc);if(b!==false){c.removeClass(d.tableClass)}};this.addParser=function(a){var b,c=parsers.length,d=true;for(b=0;b1){d=$(document.createDocumentFragment());c=b.children("tr").appendTo(d);for(i=0;i'+this.innerHTML+"
    ";if(i.onRenderHeader){i.onRenderHeader.apply(e,[a])}this.column=b[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(j.getData(d,c,"sortInitialOrder")||i.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;if(j.getData(d,c,"sorter")==="false"){this.sortDisabled=true}this.lockedOrder=false;f=j.getData(d,c,"lockedOrder")||false;if(typeof f!=="undefined"&&f!==false){this.order=this.lockedOrder=formatSortingOrder(f)?[1,1,1]:[0,0,0]}if(!this.sortDisabled){e=d.addClass(i.cssHeader)}i.headerList[a]=this;d.parent().addClass(i.cssHeader)});if(a.config.debug){benchmark("Built headers:",g);log(h)}return h}function isValueInArray(a,b){var c,d=b.length;for(c=0;c1&&d.length){for(g=0;g");$("tr:first td",a.tBodies[0]).each(function(){b.append($("").css("width",$(this).width()))});$(a).prepend(b)}}function updateHeaderSortCount(a,b){var c,d,e,f=a.config,g=b.length;for(c=0;ck){return 1}}o=Math.max(h.length,j.length);for(n=0;nm){return 1}}return 0}function sortTextDesc(a,b,c,d){if(b===c){return 0}var e=a.config,f=e.string[e.empties[d]||e.emptyTo];if(b===""&&f!==0){return typeof f==="boolean"?f?-1:1:f||1}if(c===""&&f!==0){return typeof f==="boolean"?f?1:-1:-f||-1}if(typeof e.textSorter==="function"){return e.textSorter(c,b,a,d)}return sortText(a,c,b)}function getTextValue(a,b,c){if(b){var d,e=a.length,f=b+c;for(d=0;d thead th",selectorRemove:"tr.remove-me",debug:false,headerList:[],empties:{},strings:{},parsers:[]};this.benchmark=benchmark;this.hasInitialized=false;this.construct=function(a){return this.each(function(){if(!this.tHead||this.tBodies.length===0){return}var b,c,d,e,f,g,h,i,j,k,l,m,n=$.metadata;this.config={};f=e=$.extend(true,this.config,$.tablesorter.defaults,a);if(f.debug){$.data(this,"startoveralltimer",new Date)}d=$(this).addClass(f.tableClass);$.data(this,"tablesorter",f);f.supportsTextContent=$("x")[0].textContent==="x";buildRegex();f.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:true,bottom:false};b=buildHeaders(this);f.parsers=buildParserCache(this,b);if(!f.delayInit){buildCache(this)}fixColumnWidth(this);b.bind("mousedown.tablesorter mouseup.tablesorter",function(a,e){if(a.type==="mousedown"){m=(new Date).getTime();return!f.cancelSelection}if(e!==true&&(new Date).getTime()-m>500){return false}if(f.delayInit&&!f.cache){buildCache(d[0])}if(!this.sortDisabled){d.trigger("sortStart",d[0]);c=$(this);i=!a[f.sortMultiSortKey];this.count=(this.count+1)%(f.sortReset?3:2);if(f.sortRestart){g=this;b.each(function(){if(this!==g&&(i||!$(this).is("."+f.cssDesc+",."+f.cssAsc))){this.count=-1}})}g=this.column;if(i){f.sortList=[];if(f.sortForce!==null){j=f.sortForce;for(h=0;h1){for(h=1;h1){for(h=1;h0){d.trigger("sorton",[f.sortList,!f.initWidgets])}else if(f.initWidgets){applyWidget(this)}this.hasInitialized=true;if(f.debug){$.tablesorter.benchmark("Overall initialization time",$.data(this,"startoveralltimer"))}d.trigger("tablesorter-initialized",this);if(typeof f.initialized==="function"){f.initialized(this)}})};this.destroy=function(a,b){var c=$(a),d=a.config;c.find("thead:first tr:not(."+d.cssHeader+")").remove();c.find("thead:first .tablesorter-resizer").remove();c.unbind("update updateCell addRows sorton appendCache applyWidgetId applyWidgets destroy mouseup mouseleave").find(d.selectorHeaders).unbind("click mousedown mousemove mouseup").removeClass(d.cssHeader+" "+d.cssAsc+" "+d.cssDesc);if(b!==false){c.removeClass(d.tableClass)}};this.addParser=function(a){var b,c=parsers.length,d=true;for(b=0;b1){f=0;c=b.find("tr:visible");b.addClass("tablesorter-hidden");c.each(function(){d=$(this);if(!m.test(this.className)){f++}g=f%2===0;d.removeClass(o[g?1:0]).addClass(o[g?0:1])});b.removeClass("tablesorter-hidden")}}if(l.debug){ts.benchmark("Applying Zebra widget",h)}}})}(jQuery) diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index 4d7b45b3..5a1f89f0 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -1,4 +1,4 @@ -/*! tableSorter 2.3 widgets - updated 5/23/2012 +/*! tableSorter 2.3 widgets - updated 5/28/2012 * * jQuery UI Theme * Column Styles @@ -125,7 +125,7 @@ $.tablesorter.addWidget({ $.tablesorter.addWidget({ id: "columns", format: function(table) { - var $tb, $tr, $td, $f, time, last, rmv, i, j, k, l, + var $tb, $tr, $td, $t, time, last, rmv, i, k, l, c = table.config, b = $(table).children('tbody:not(.' + c.cssInfoBlock + ')'), list = c.sortList, @@ -142,14 +142,14 @@ $.tablesorter.addWidget({ // check if there is a sort (on initialization there may not be one) for (k = 0; k < b.length; k++ ) { $tb = $(b[k]); - $f = $(document.createDocumentFragment()); - $tr = $tb.children('tr').appendTo($f); + $tr = $tb.addClass('tablesorter-hidden').children('tr'); l = $tr.length; // loop through the visible rows - for (j = 0; j < l; j++) { - if ($tr[j].style.display !== 'none') { + $tr.each(function(){ + $t = $(this); + if (this.style.display !== 'none') { // remove all columns class names - $td = $tr.eq(j).children().removeClass(rmv); + $td = $t.children().removeClass(rmv); // add appropriate column class names if (list && list[0]) { // primary sort column class @@ -162,8 +162,8 @@ $.tablesorter.addWidget({ } } } - } - $tb.append($tr); + }); + $tb.removeClass('tablesorter-hidden'); } if (c.debug) { $.tablesorter.benchmark("Applying Columns widget", time); @@ -178,7 +178,7 @@ $.tablesorter.addWidget({ id: "filter", format: function(table) { if (!$(table).hasClass('hasFilters')) { - var i, j, k, l, cv, v, r, t, x, cr, $tb, $tr, $td, $f, + var i, j, k, l, cv, v, r, t, x, cr, $tb, $tr, $td, c = table.config, wo = c.widgetOptions, css = wo.filter_cssFilter || 'tablesorter-filter', @@ -197,8 +197,7 @@ $.tablesorter.addWidget({ cv = v.join(''); for (k = 0; k < b.length; k++ ) { $tb = $(b[k]); - $f = $(document.createDocumentFragment()); - $tr = $tb.children('tr').appendTo($f); + $tr = $tb.addClass('tablesorter-hidden').children('tr'); l = $tr.length; // loop through the rows for (j = 0; j < l; j++) { @@ -231,7 +230,7 @@ $.tablesorter.addWidget({ } } } - $tb.append($tr); + $tb.removeClass('tablesorter-hidden'); } if (c.debug) { $.tablesorter.benchmark("Completed filter widget search", time); @@ -256,6 +255,8 @@ $.tablesorter.addWidget({ $t .find('thead').eq(0).append(fr += '') .find('input.' + css).bind('keyup search', function(e, delay){ + // ignore arrow and meta keys; allow backspace + if ((e.which < 32 && e.which !== 8) || (e.which >= 37 && e.which <=40)) { return; } // skip delay if (delay === false) { findRows(); @@ -317,11 +318,11 @@ $.tablesorter.addWidget({ }); // set sticky header cell width and link clicks to real header hdrCells.each(function(i){ - var t = $(this), - s = stkyCells.eq(i) + var t = $(this); + stkyCells.eq(i) // clicking on sticky will trigger sort - .bind('click', function(e){ - t.trigger(e); + .bind('mouseup', function(e){ + t.trigger(e, true); // external mouseup flag (click timer is ignored) }) // prevent sticky header text selection .bind('mousedown', function(){ @@ -374,12 +375,11 @@ $.tablesorter.addWidget({ format: function(table) { if ($(table).hasClass('hasResizable')) { return; } $(table).addClass('hasResizable'); - var i, j, w, s, c = table.config, + var j, s, c = table.config, $cols = $(c.headerList).filter(':gt(0)'), position = 0, $target = null, $prev = null, - len = $cols.length, stopResize = function(){ position = 0; $target = $prev = null; @@ -403,8 +403,7 @@ $.tablesorter.addWidget({ .bind('mousemove', function(e){ // ignore mousemove if no mousedown if (position === 0 || !$target) { return; } - var w = e.pageX - position, - n = $prev; + var w = e.pageX - position; // make sure if ( $target.width() < -w || ( $prev && $prev.width() <= w )) { return; } // resize current column @@ -425,6 +424,7 @@ $.tablesorter.addWidget({ $target = $(e.target).closest('th'); $prev = $target.prev(); position = e.pageX; + return false; }); $(table).find('thead').bind('mouseup mouseleave', function(){ stopResize(); @@ -443,7 +443,7 @@ $.tablesorter.addWidget({ thisWidget.format(table, true); }, format: function(table, init) { - var n, d, k, sl, time, c = table.config, sortList = { "sortList" : c.sortList }; + var sl, time, c = table.config, sortList = { "sortList" : c.sortList }; if (c.debug) { time = new Date(); } diff --git a/js/jquery.tablesorter.widgets.min.js b/js/jquery.tablesorter.widgets.min.js index 76101c6f..b6863bc7 100644 --- a/js/jquery.tablesorter.widgets.min.js +++ b/js/jquery.tablesorter.widgets.min.js @@ -1,10 +1,10 @@ -/*! tableSorter 2.3 widgets - updated 5/19/2012 */ +/*! tableSorter 2.3 widgets - updated 5/28/2012 */ ;(function(b){ -b.tablesorter.storage=function(a,e,c){var d,h=!1;d={};var j=a.id||b(".tablesorter").index(b(a)),f=window.location.pathname;try{h=!!localStorage.getItem}catch(g){}b.parseJSON&&(h?d=b.parseJSON(localStorage[e])||{}:(d=document.cookie.split(/[;\s|=]/),a=b.inArray(e,d)+1,d=0!==a?b.parseJSON(d[a])||{}:{}));if(c&&JSON&&JSON.hasOwnProperty("stringify")){if(!d[f]||!d[f][j])d[f]||(d[f]={});d[f][j]=c;h?localStorage[e]=JSON.stringify(d):(a=new Date,a.setTime(a.getTime()+31536E6),document.cookie= e+"="+JSON.stringify(d).replace(/\"/g,'"')+"; expires="+a.toGMTString()+"; path=/")}else return d&&d.hasOwnProperty(f)&&d[f].hasOwnProperty(j)?d[f][j]:{}}; -b.tablesorter.addWidget({id:"uitheme",format:function(a){var e,c,d,h,j,f=b(a),g=a.config,i=g.widgetOptions,k=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"],k=g.widgetUitheme&&g.widgetUitheme.hasOwnProperty("css")?g.widgetUitheme.css||k:i&&i.hasOwnProperty("uitheme")?i.uitheme:k;d=k.join(" ");g.debug&&(e=new Date); f.hasClass("ui-theme")||(f.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"),b.each(g.headerList,function(){b(this).addClass("ui-widget-header ui-corner-all ui-state-default").append('').wrapInner('
    ').hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")})}));b.each(g.headerList,function(a){h=b(this);if(this.sortDisabled)h.find("span.ui-icon").removeClass(d+" ui-icon");else{c=h.hasClass(g.cssAsc)? k[1]:h.hasClass(g.cssDesc)?k[2]:h.hasClass(g.cssHeader)?k[0]:"";j=f.hasClass("hasStickyHeaders")?f.find("tr."+(i.stickyHeaders||"tablesorter-stickyHeader")).find("th").eq(a).add(h):h;j[c===k[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(d).addClass(c)}});g.debug&&b.tablesorter.benchmark("Applying uitheme widget",e)}}); -b.tablesorter.addWidget({id:"columns",format:function(a){var e,c,d,h,j,f,g,i,k,l=a.config,m=b(a).children("tbody:not(."+l.cssInfoBlock+")"),o=l.sortList, p=o.length,n=["primary","secondary","tertiary"],n=l.widgetColumns&&l.widgetColumns.hasOwnProperty("css")?l.widgetColumns.css||n:l.widgetOptions&&l.widgetOptions.hasOwnProperty("columns")?l.widgetOptions.columns||n:n;h=n.length-1;j=n.join(" ");l.debug&&(d=new Date);if(o&&o[0])for(i=0;i',p;i.debug&&(p=new Date);for(e=0;eb.top&&a
    ').wrapInner('
    ')}).bind("mousemove",function(a){if(0!==j&&f){var b=a.pageX-j;f.width()<-b||g&&g.width()<=b||(g.width(g.width()+b),j=a.pageX)}}).bind("mouseup", function(){c&&(b.tablesorter.storage&&f)&&(c[g.index()]=g.width(),b.tablesorter.storage(a,"tablesorter-resizable",c));i();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){f=b(a.target).closest("th");g=f.prev();j=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){i()})}}}); -b.tablesorter.addWidget({id:"saveSort",init:function(a,b,c){c.format(a,!0)},format:function(a,e){var c,d,h=a.config;c={sortList:h.sortList};h.debug&&(d=new Date);b(a).hasClass("hasSaveSort")?a.hasInitialized&& b.tablesorter.storage&&(b.tablesorter.storage(a,"tablesorter-savesort",c),h.debug&&b.tablesorter.benchmark("saveSort widget: Saving last sort: "+h.sortList,d)):(b(a).addClass("hasSaveSort"),c="",b.tablesorter.storage&&(c=(c=b.tablesorter.storage(a,"tablesorter-savesort"))&&c.hasOwnProperty("sortList")&&b.isArray(c.sortList)?c.sortList:"",h.debug&&b.tablesorter.benchmark("saveSort: Last sort loaded: "+c,d)),e&&c&&0').wrapInner('
    ').hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")})}));b.each(f.headerList,function(a){g=b(this);if(this.sortDisabled)g.find("span.ui-icon").removeClass(d+" ui-icon");else{c=g.hasClass(f.cssAsc)? i[1]:g.hasClass(f.cssDesc)?i[2]:g.hasClass(f.cssHeader)?i[0]:"";j=h.hasClass("hasStickyHeaders")?h.find("tr."+(k.stickyHeaders||"tablesorter-stickyHeader")).find("th").eq(a).add(g):g;j[c===i[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(d).addClass(c)}});f.debug&&b.tablesorter.benchmark("Applying uitheme widget",e)}}); +b.tablesorter.addWidget({id:"columns",format:function(a){var e,c,d,g,j,h,f,k,i=a.config,o=b(a).children("tbody:not(."+i.cssInfoBlock+")"),m=i.sortList, p=m.length,n=["primary","secondary","tertiary"],n=i.widgetColumns&&i.widgetColumns.hasOwnProperty("css")?i.widgetColumns.css||n:i.widgetOptions&&i.widgetOptions.hasOwnProperty("columns")?i.widgetOptions.columns||n:n;j=n.length-1;h=n.join(" ");i.debug&&(g=new Date);for(k=0;k',y=RegExp(l.cssChildRow),t,w,x=function(){l.debug&&(t=new Date);h=s.find("thead").eq(0).children("tr").find("input."+ r).map(function(){e=b(this).val()||"";return q.filter_ignoreCase?e.toLocaleLowerCase():e}).get();j=h.join("");for(d=0;db.which&&8!==b.which||37<=b.which&&40>=b.which||(!1===a?x():(clearTimeout(w),w=setTimeout(function(){x()},q.filter_searchDelay||300)))});l.debug&&b.tablesorter.benchmark("Applying Filter widget", t)}}}); +b.tablesorter.addWidget({id:"stickyHeaders",format:function(a){if(!b(a).hasClass("hasStickyHeaders")){var e=b(a).addClass("hasStickyHeaders"),c=a.config.widgetOptions,d=b(window),g=b(a).children("thead"),j=g.children("tr:not(.sticky-false)").children(),h=c.stickyHeaders||"tablesorter-stickyHeader",f=j.eq(0),k=e.find("tfoot"),i=g.find("tr.tablesorter-header:not(.sticky-false)").clone().removeClass("tablesorter-header").addClass(h).css({width:g.outerWidth(!0),position:"fixed",left:f.offset().left, margin:0,top:0,visibility:"hidden",zIndex:10}),o=i.children(),m="";e.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter("."+h).children();d.filter(":not(."+h+")").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){d.resize()});j.each(function(a){var c=b(this);o.eq(a).bind("mouseup",function(b){c.trigger(b,!0)}).bind("mousedown",function(){this.onselectstart=function(){return!1};return!1}).find(".tablesorter-header-inner").width(c.find(".tablesorter-header-inner").width())}); g.prepend(i);d.scroll(function(){var b=f.offset(),a=d.scrollTop(),c=e.height()-(f.height()+(k.height()||0)),a=a>b.top&&a
    ').wrapInner('
    ')}).bind("mousemove", function(b){if(0!==j&&h){var a=b.pageX-j;h.width()<-a||f&&f.width()<=a||(f.width(f.width()+a),j=b.pageX)}}).bind("mouseup",function(){c&&(b.tablesorter.storage&&h)&&(c[f.index()]=f.width(),b.tablesorter.storage(a,"tablesorter-resizable",c));k();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){h=b(a.target).closest("th");f=h.prev();j=a.pageX;return!1});b(a).find("thead").bind("mouseup mouseleave",function(){k()})}}}); +b.tablesorter.addWidget({id:"saveSort",init:function(a,b,c){c.format(a, !0)},format:function(a,e){var c,d,g=a.config;c={sortList:g.sortList};g.debug&&(d=new Date);b(a).hasClass("hasSaveSort")?a.hasInitialized&&b.tablesorter.storage&&(b.tablesorter.storage(a,"tablesorter-savesort",c),g.debug&&b.tablesorter.benchmark("saveSort widget: Saving last sort: "+g.sortList,d)):(b(a).addClass("hasSaveSort"),c="",b.tablesorter.storage&&(c=(c=b.tablesorter.storage(a,"tablesorter-savesort"))&&c.hasOwnProperty("sortList")&&b.isArray(c.sortList)?c.sortList:"",g.debug&&b.tablesorter.benchmark("saveSort: Last sort loaded: "+ c,d)),e&&c&&0