fixed the add widget init mess

This commit is contained in:
Rob Garrison 2012-02-20 18:14:25 -06:00
parent bf553daf8d
commit 799609662f
7 changed files with 49 additions and 63 deletions

View File

@ -34,6 +34,10 @@ Included all original [document pages](http://mottie.github.com/tablesorter/docs
View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt). View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt).
#### 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) #### 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! * 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!
@ -76,25 +80,3 @@ View the [complete listing here](http://mottie.github.com/tablesorter/changelog.
* This widget will save the last sort to local storage, and will fallback to cookies. * 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). * 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). * 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).

View File

@ -1,5 +1,10 @@
TableSorter Change Log TableSorter Change Log
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) Version 2.0.29 (2012-2-20)
============================ ============================

View File

@ -1,6 +1,6 @@
/* /*
* TableSorter 2.0 - Client-side table sorting with ease! * TableSorter 2.0 - Client-side table sorting with ease!
* Version 2.0.29 * Version 2.0.30
* @requires jQuery v1.2.3 * @requires jQuery v1.2.3
* *
* Copyright (c) 2007 Christian Bach * Copyright (c) 2007 Christian Bach
@ -117,10 +117,11 @@
} }
function benchmark(s, d) { function benchmark(s, d) {
log(s + "," + (new Date().getTime() - d.getTime()) + "ms"); log(s + " (" + (new Date().getTime() - d.getTime()) + "ms)");
} }
this.benchmark = benchmark; this.benchmark = benchmark;
this.hasInitialized = false;
function getElementText(config, node, cellIndex) { function getElementText(config, node, cellIndex) {
var text = "", te = config.textExtraction; var text = "", te = config.textExtraction;
@ -178,7 +179,7 @@
node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex); node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex);
nodeValue = trimAndGetNodeText(table.config, node, cellIndex); nodeValue = trimAndGetNodeText(table.config, node, cellIndex);
if (table.config.debug) { if (table.config.debug) {
log('Checking if value was empty on row:' + rowIndex); log('Checking if value was empty on row ' + rowIndex + ', column:' + cellIndex + ": " + nodeValue);
} }
} else { } else {
keepLooking = false; keepLooking = false;
@ -215,7 +216,7 @@
p = detectParserForColumn(table, rows, -1, i); p = detectParserForColumn(table, rows, -1, i);
} }
if (table.config.debug) { if (table.config.debug) {
parsersDebug += "column:" + i + " parser:" + p.id + "\n"; parsersDebug += "column:" + i + "; parser:" + p.id + "\n";
} }
list.push(p); list.push(p);
} }
@ -260,21 +261,12 @@
cache.normalized.push(cols); cache.normalized.push(cols);
} }
if (table.config.debug) { if (table.config.debug) {
benchmark("Building cache for " + totalRows + " rows:", cacheTime); benchmark("Building cache for " + totalRows + " rows", cacheTime);
} }
table.config.cache = cache; table.config.cache = cache;
return cache; return cache;
} }
function initWidgets(table){
var i, w = table.config.widgets, l = w.length;
for (i = 0; i < l; i++) {
if (w[i] && w[i].hasOwnProperty('init')) {
w[i].init(table, widgets, w[i]);
}
}
}
function getWidgetById(name) { function getWidgetById(name) {
var i, w, l = widgets.length; var i, w, l = widgets.length;
for (i = 0; i < l; i++) { for (i = 0; i < l; i++) {
@ -285,16 +277,20 @@
} }
} }
function applyWidget(table) { function applyWidget(table, init) {
var c = table.config.widgets, var c = table.config.widgets,
i, w, l = c.length; i, w, l = c.length;
for (i = 0; i < l; i++) { for (i = 0; i < l; i++) {
w = getWidgetById(c[i]); w = getWidgetById(c[i]);
if ( w && w.hasOwnProperty('format') ) { if ( w ) {
if (init && w.hasOwnProperty('init')) {
w.init(table, widgets, w);
} else if (!init && w.hasOwnProperty('format')) {
w.format(table); w.format(table);
} }
} }
} }
}
function appendToTable(table, cache) { function appendToTable(table, cache) {
var c = table.config, var c = table.config,
@ -322,7 +318,7 @@
c.appender(table, rows); c.appender(table, rows);
} }
if (c.debug) { if (c.debug) {
benchmark("Rebuilt table:", appendTime); benchmark("Rebuilt table", appendTime);
} }
// apply table widgets // apply table widgets
applyWidget(table); applyWidget(table);
@ -427,7 +423,7 @@
c.headerList[index] = this; c.headerList[index] = this;
}); });
if (c.debug) { if (c.debug) {
benchmark("Built headers:", time); benchmark("Built headers", time);
log($tableHeaders); log($tableHeaders);
} }
return $tableHeaders; return $tableHeaders;
@ -534,7 +530,7 @@
dynamicExp += "}; "; dynamicExp += "}; ";
eval(dynamicExp); eval(dynamicExp);
cache.normalized.sort(sortWrapper); // sort using eval expression cache.normalized.sort(sortWrapper); // sort using eval expression
if (tc.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; return cache;
} }
@ -781,15 +777,16 @@
if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) { if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
config.sortList = $(this).metadata().sortlist; config.sortList = $(this).metadata().sortlist;
} }
// initialize widgets // apply widget init code
initWidgets(this); applyWidget(this, true);
// if user has supplied a sort list to constructor. // if user has supplied a sort list to constructor.
if (config.sortList.length > 0) { if (config.sortList.length > 0) {
$this.trigger("sorton", [config.sortList]); $this.trigger("sorton", [config.sortList]);
} else { } else {
// apply widgets // apply widget format
applyWidget(this); applyWidget(this);
} }
this.hasInitialized = true;
}); });
}; };
this.addParser = function(parser) { this.addParser = function(parser) {

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/* TableSorter 2.0 Widgets - updated 2/1/2012 /* TableSorter 2.0 Widgets - updated 2/20/2012
* *
* jQuery UI Theme * jQuery UI Theme
* Column Styles * Column Styles
@ -301,6 +301,7 @@ $.tablesorter.addWidget({
time = new Date(); time = new Date();
} }
if (c.widgetsavesort){ if (c.widgetsavesort){
if (table.hasInitialized) {
n = 'tablesorter' + (c.tableIndex || 0) + table.id; n = 'tablesorter' + (c.tableIndex || 0) + table.id;
// save table sort // save table sort
if (c.hasLocalStorage) { if (c.hasLocalStorage) {
@ -313,6 +314,7 @@ $.tablesorter.addWidget({
if (c.debug) { if (c.debug) {
$.tablesorter.benchmark('saveSort: Saving sort to "' + n + '" in ' + (c.hasLocalStorage ? 'local storage' : 'a cookie'), time); $.tablesorter.benchmark('saveSort: Saving sort to "' + n + '" in ' + (c.hasLocalStorage ? 'local storage' : 'a cookie'), time);
} }
}
} else { } else {
// set table sort on initial run of the widget // set table sort on initial run of the widget
c.widgetsavesort = true; c.widgetsavesort = true;
@ -341,7 +343,7 @@ $.tablesorter.addWidget({
// this method allows using this widget in the original tablesorter plugin; but then it will run all widgets twice. // this method allows using this widget in the original tablesorter plugin; but then it will run all widgets twice.
if (init && sortList && sortList.length > 0) { if (init && sortList && sortList.length > 0) {
c.sortList = sortList; c.sortList = sortList;
} else if (sortList && sortList.length > 0) { } else if (table.hasInitialized && sortList && sortList.length > 0) {
// update sort change // update sort change
$(table).trigger('sorton', [sortList]); $(table).trigger('sorton', [sortList]);
} }

View File

@ -1,4 +1,4 @@
/* TableSorter 2.0 Widgets - updated 2/1/2012 */ /* TableSorter 2.0 Widgets - updated 2/20/2012 */
(function(b){ (function(b){
b.tablesorter.addWidget({id:"uitheme",format:function(e){var g,a,d,f,h,c=e.config,i=b(e),j=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"];c.widgetUitheme&&c.widgetUitheme.hasOwnProperty("css")&&(j=c.widgetUitheme.css||j);d=j.join(" ");c.debug&&(g=new Date);i.is(".ui-theme")||(i.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"),b.each(c.headerList,function(){b(this).addClass("ui-widget-header ui-corner-all").append('<span class="ui-icon"/>').wrapInner('<div class="inner"/>').hover(function(){b(this).addClass("ui-state-hover")}, function(){b(this).removeClass("ui-state-hover")})}));b.each(c.headerList,function(e){f=b(this);this.sortDisabled?f.find("span.ui-icon").removeClass(d+" ui-icon"):(a=f.hasClass(c.cssAsc)?j[1]:f.hasClass(c.cssDesc)?j[2]:f.hasClass(c.cssHeader)?j[0]:"",h=i.hasClass("hasStickyHeaders")?i.find("tr.stickyHeader").find("th").eq(e).add(f):f,h[a===j[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(d).addClass(a))});c.debug&&b.tablesorter.benchmark("Applying uitheme widget", g)}}); b.tablesorter.addWidget({id:"uitheme",format:function(e){var g,a,d,f,h,c=e.config,i=b(e),j=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"];c.widgetUitheme&&c.widgetUitheme.hasOwnProperty("css")&&(j=c.widgetUitheme.css||j);d=j.join(" ");c.debug&&(g=new Date);i.is(".ui-theme")||(i.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"),b.each(c.headerList,function(){b(this).addClass("ui-widget-header ui-corner-all").append('<span class="ui-icon"/>').wrapInner('<div class="inner"/>').hover(function(){b(this).addClass("ui-state-hover")}, function(){b(this).removeClass("ui-state-hover")})}));b.each(c.headerList,function(e){f=b(this);this.sortDisabled?f.find("span.ui-icon").removeClass(d+" ui-icon"):(a=f.hasClass(c.cssAsc)?j[1]:f.hasClass(c.cssDesc)?j[2]:f.hasClass(c.cssHeader)?j[0]:"",h=i.hasClass("hasStickyHeaders")?i.find("tr.stickyHeader").find("th").eq(e).add(f):f,h[a===j[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(d).addClass(a))});c.debug&&b.tablesorter.benchmark("Applying uitheme widget", g)}});
@ -6,5 +6,5 @@ b.tablesorter.addWidget({id:"columns",format:function(e){var g,a,d,f,h=e.config,
b.tablesorter.addWidget({id:"filter",format:function(e){if(!e.config.filtering){var g,a,d,f,h,c,i=e.config,j=i.headerList.length,k=b(e),e='<tr class="filters">',l;i.debug&&(l=new Date);for(g=0;g<j;g++)e+='<td><input type="text" class="filter" data-col="'+g+'" style="',e+=i.headers[g]&&"filter"in i.headers[g]&&!1===i.headers[g].filter||b(i.headerList[g]).is(".filter-false")?"display:none":"",e+='"></td>';k.find("thead").append(e+="</tr>").find(".filter").bind("keyup",function(){a=k.find(".filter").map(function(){return(b(this).val()|| "").toLowerCase()}).get();""===a.join("")?k.find("tr").show():k.find("tbody").find("tr:not(.expand-child)").each(function(){d=!0;h=b(this).nextUntil("tr:not(.expand-child)");f=h.length&&("undefined"!==typeof i.widgetFilterChildRows?i.widgetFilterChildRows:1)?h.text():"";c=b(this).find("td");for(g=0;g<j;g++)""!==a[g]&&0<=(c.eq(g).text()+f).toLowerCase().indexOf(a[g])?d=d?!0:!1:""!==a[g]&&(d=!1);b(this)[d?"show":"hide"]();if(h.length)h[d?"show":"hide"]()});k.trigger("applyWidgets")});i.filtering=!0; i.debug&&b.tablesorter.benchmark("Applying Filter widget",l)}}}); b.tablesorter.addWidget({id:"filter",format:function(e){if(!e.config.filtering){var g,a,d,f,h,c,i=e.config,j=i.headerList.length,k=b(e),e='<tr class="filters">',l;i.debug&&(l=new Date);for(g=0;g<j;g++)e+='<td><input type="text" class="filter" data-col="'+g+'" style="',e+=i.headers[g]&&"filter"in i.headers[g]&&!1===i.headers[g].filter||b(i.headerList[g]).is(".filter-false")?"display:none":"",e+='"></td>';k.find("thead").append(e+="</tr>").find(".filter").bind("keyup",function(){a=k.find(".filter").map(function(){return(b(this).val()|| "").toLowerCase()}).get();""===a.join("")?k.find("tr").show():k.find("tbody").find("tr:not(.expand-child)").each(function(){d=!0;h=b(this).nextUntil("tr:not(.expand-child)");f=h.length&&("undefined"!==typeof i.widgetFilterChildRows?i.widgetFilterChildRows:1)?h.text():"";c=b(this).find("td");for(g=0;g<j;g++)""!==a[g]&&0<=(c.eq(g).text()+f).toLowerCase().indexOf(a[g])?d=d?!0:!1:""!==a[g]&&(d=!1);b(this)[d?"show":"hide"]();if(h.length)h[d?"show":"hide"]()});k.trigger("applyWidgets")});i.filtering=!0; i.debug&&b.tablesorter.benchmark("Applying Filter widget",l)}}});
b.tablesorter.addWidget({id:"stickyHeaders",format:function(e){if(!b(e).hasClass("hasStickyHeaders")){var g=b(e).addClass("hasStickyHeaders"),a=b(window),d=b(e).find("thead"),f=d.find("tr").children(),h=f.eq(0),c=parseInt(f.eq(0).css("border-left-width"),10),i=d.find("tr:not(.filters)").clone().addClass("stickyHeader").css({width:d.outerWidth()+2*c,position:"fixed",left:h.offset().left,marginLeft:-c,top:0,visibility:"hidden",zIndex:10}), j=i.children(),k;g.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter(".stickyHeader").children();d.filter(":not(.stickyHeader)").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){a.resize()});f.each(function(a){var c=b(this);j.eq(a).width(c.width()).bind("click",function(a){c.trigger(a)}).bind("mousedown",function(){this.onselectstart=function(){return!1};return!1})});d.prepend(i);a.scroll(function(){var c=h.offset(),b=a.scrollTop(), b=b>c.top&&b<c.top+g.find("tbody").height()?"visible":"hidden";i.css({left:c.left-a.scrollLeft(),visibility:b});b!==k&&(a.resize(),k=b)}).resize(function(){i.css({left:h.offset().left-a.scrollLeft(),width:d.outerWidth()+2*c});j.each(function(a){b(this).width(f.eq(a).width())})})}}}); b.tablesorter.addWidget({id:"stickyHeaders",format:function(e){if(!b(e).hasClass("hasStickyHeaders")){var g=b(e).addClass("hasStickyHeaders"),a=b(window),d=b(e).find("thead"),f=d.find("tr").children(),h=f.eq(0),c=parseInt(f.eq(0).css("border-left-width"),10),i=d.find("tr:not(.filters)").clone().addClass("stickyHeader").css({width:d.outerWidth()+2*c,position:"fixed",left:h.offset().left,marginLeft:-c,top:0,visibility:"hidden",zIndex:10}), j=i.children(),k;g.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter(".stickyHeader").children();d.filter(":not(.stickyHeader)").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){a.resize()});f.each(function(a){var c=b(this);j.eq(a).width(c.width()).bind("click",function(a){c.trigger(a)}).bind("mousedown",function(){this.onselectstart=function(){return!1};return!1})});d.prepend(i);a.scroll(function(){var c=h.offset(),b=a.scrollTop(), b=b>c.top&&b<c.top+g.find("tbody").height()?"visible":"hidden";i.css({left:c.left-a.scrollLeft(),visibility:b});b!==k&&(a.resize(),k=b)}).resize(function(){i.css({left:h.offset().left-a.scrollLeft(),width:d.outerWidth()+2*c});j.each(function(a){b(this).width(f.eq(a).width())})})}}});
b.tablesorter.addWidget({id:"resizable",format:function(e){if(!e.config.resizable){var g,a=e.config,d=a.headerList,f=d.length,h=function(){a.resizable_position=0;a.resizable_target=null;b(window).trigger("resize")};a.resizable_target= null;a.resizable_position=0;for(g=1;g<f;g++)b(d[g]).append('<div class="resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>').wrapInner('<div style="position:relative;height:100%;width:100%"></div>').find(".resizer").bind("mousedown",function(c){a.resizable_target=b(c.target).closest("th");a.resizable_position=c.pageX}).end().bind("mousemove",function(c){if(!(0===a.resizable_position||null===typeof a.resizable_target)){var b=c.pageX-a.resizable_position, d=a.resizable_target.closest("th").prev();a.resizable_target.width()<-b||d&&d.width()<=b||(d.width(d.width()+b),a.resizable_position=c.pageX)}}).bind("mouseup",function(){h();return!1});b(e).find("thead").bind("mouseup mouseleave",function(){h()});a.resizable=!0}}}); b.tablesorter.addWidget({id:"resizable",format:function(e){if(!e.config.resizable){var g,a=e.config,d=a.headerList,f=d.length,h=function(){a.resizable_position=0;a.resizable_target=null;b(window).trigger("resize")};a.resizable_target= null;a.resizable_position=0;for(g=1;g<f;g++)b(d[g]).append('<div class="resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>').wrapInner('<div style="position:relative;height:100%;width:100%"></div>').find(".resizer").bind("mousedown",function(c){a.resizable_target=b(c.target).closest("th");a.resizable_position=c.pageX}).end().bind("mousemove",function(c){if(!(0===a.resizable_position||null===typeof a.resizable_target)){var b=c.pageX-a.resizable_position, d=a.resizable_target.closest("th").prev();a.resizable_target.width()<-b||d&&d.width()<=b||(d.width(d.width()+b),a.resizable_position=c.pageX)}}).bind("mouseup",function(){h();return!1});b(e).find("thead").bind("mouseup mouseleave",function(){h()});a.resizable=!0}}});
b.tablesorter.addWidget({id:"saveSort",init:function(b,g,a){a.format(b,!0)},format:function(e,g){var a,d,f,h,c=e.config;f='{"sortList":'+JSON.stringify(c.sortList)+"}";c.debug&&(h=new Date);if(c.widgetsavesort)a="tablesorter"+(c.tableIndex|| 0)+e.id,c.hasLocalStorage?localStorage[a]=f:(d=new Date,d.setTime(d.getTime()+31536E6),document.cookie=a+"="+f+"; expires="+d.toGMTString()+"; path=/"),c.debug&&b.tablesorter.benchmark('saveSort: Saving sort to "'+a+'" in '+(c.hasLocalStorage?"local storage":"a cookie"),h);else{c.widgetsavesort=!0;c.hasLocalStorage=!1;try{localStorage.getItem&&(c.hasLocalStorage=!0)}catch(i){}c.tableIndex=b(".tablesorter").index(b(e));a="tablesorter"+(c.tableIndex||0)+e.id;c.hasLocalStorage?d=localStorage[a]:(f=document.cookie.split(/[;\s|=]/), d=b.inArray(a,f)+1,d=0!==d?f[d]:"");try{d=b.parseJSON(d)}catch(j){d=""}f=d&&d.hasOwnProperty("sortList")&&b.isArray(d.sortList)?d.sortList:"";c.debug&&b.tablesorter.benchmark('saveSort: Last sort for "'+a+'" obtained from '+(c.hasLocalStorage?"local storage":"a cookie"),h);g&&f&&0<f.length?c.sortList=f:f&&0<f.length&&b(e).trigger("sorton",[f])}}}) b.tablesorter.addWidget({id:"saveSort",init:function(b,g,a){a.format(b,!0)},format:function(e,g){var a,d,f,h,c=e.config;f='{"sortList":'+JSON.stringify(c.sortList)+"}";c.debug&&(h=new Date);if(c.widgetsavesort)e.hasInitialized&&(a="tablesorter"+ (c.tableIndex||0)+e.id,c.hasLocalStorage?localStorage[a]=f:(d=new Date,d.setTime(d.getTime()+31536E6),document.cookie=a+"="+f+"; expires="+d.toGMTString()+"; path=/"),c.debug&&b.tablesorter.benchmark('saveSort: Saving sort to "'+a+'" in '+(c.hasLocalStorage?"local storage":"a cookie"),h));else{c.widgetsavesort=!0;c.hasLocalStorage=!1;try{localStorage.getItem&&(c.hasLocalStorage=!0)}catch(i){}c.tableIndex=b(".tablesorter").index(b(e));a="tablesorter"+(c.tableIndex||0)+e.id;c.hasLocalStorage?d=localStorage[a]: (f=document.cookie.split(/[;\s|=]/),d=b.inArray(a,f)+1,d=0!==d?f[d]:"");try{d=b.parseJSON(d)}catch(j){d=""}f=d&&d.hasOwnProperty("sortList")&&b.isArray(d.sortList)?d.sortList:"";c.debug&&b.tablesorter.benchmark('saveSort: Last sort for "'+a+'" obtained from '+(c.hasLocalStorage?"local storage":"a cookie"),h);g&&f&&0<f.length?c.sortList=f:e.hasInitialized&&f&&0<f.length&&b(e).trigger("sorton",[f])}}})
})(jQuery); })(jQuery);

View File

@ -1,6 +1,6 @@
{ {
"name": "tablesorter", "name": "tablesorter",
"version": "2.0.29", "version": "2.0.30",
"title": "tablesorter", "title": "tablesorter",
"author": { "author": {
"name": "Christian Bach", "name": "Christian Bach",