diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index fcbfa5d9..4ad49b05 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -1859,11 +1859,11 @@ ts.addWidget({ .unbind( 'pagerComplete filterEnd '.split(' ').join(namespace) ) .next('.' + ts.css.stickyWrap).remove(); if (wo.$sticky && wo.$sticky.length) { wo.$sticky.remove(); } // remove cloned table - // don't unbind if any table on the page still has stickyheaders applied - if (!$('.hasStickyHeaders').length) { - $(window).add(wo.stickyHeaders_xScroll).add(wo.stickyHeaders_yScroll).add(wo.stickyHeaders_attachTo) - .unbind( 'scroll resize '.split(' ').join(namespace) ); - } + $(window) + .add(wo.stickyHeaders_xScroll) + .add(wo.stickyHeaders_yScroll) + .add(wo.stickyHeaders_attachTo) + .unbind( 'scroll resize '.split(' ').join(namespace) ); ts.addHeaderResizeEvent(table, false); } }); @@ -2091,7 +2091,8 @@ ts.addWidget({ } } }, - remove: function(table) { + remove: function(table, c) { + c.$table.removeClass('hasSaveSort'); // clear storage if (ts.storage) { ts.storage( table, 'tablesorter-savesort', '' ); } } diff --git a/js/widgets/widget-columnSelector.js b/js/widgets/widget-columnSelector.js index 1d342413..989975ae 100644 --- a/js/widgets/widget-columnSelector.js +++ b/js/widgets/widget-columnSelector.js @@ -344,7 +344,8 @@ ts.addWidget({ init: function(table, thisWidget, c, wo) { tsColSel.init(table, c, wo); }, - remove: function(table, c){ + remove: function(table, c, wo, refreshing) { + if (refreshing) { return; } var csel = c.selector; csel.$container.empty(); if (csel.$popup) { csel.$popup.empty(); } diff --git a/js/widgets/widget-cssStickyHeaders.js b/js/widgets/widget-cssStickyHeaders.js index 8363c727..f3a62596 100644 --- a/js/widgets/widget-cssStickyHeaders.js +++ b/js/widgets/widget-cssStickyHeaders.js @@ -134,7 +134,8 @@ }); }, - remove: function(table, c, wo){ + remove: function(table, c, wo, refreshing) { + if (refreshing) { return; } var namespace = c.namespace + 'cssstickyheader '; $(window).unbind('scroll resize '.split(' ').join(namespace)); c.$table diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index 83d0f98b..966c10ba 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -111,8 +111,8 @@ ts.addWidget({ } tsp.moveToPage(table, c.pager, false); }, - remove: function(table, c, wo, temp){ - tsp.destroyPager(table, c, temp); + remove: function(table, c, wo, refreshing){ + tsp.destroyPager(table, c, refreshing); } }); @@ -141,6 +141,7 @@ tsp = ts.pager = { last: {}, // save original pager size setSize: wo.pager_size, + setPage: wo.pager_startPage, events: 'filterInit filterStart filterEnd sortEnd disable enable destroy updateComplete ' + 'pageSize pageSet pageAndSize pagerUpdate ' }, c.pager); @@ -166,7 +167,7 @@ tsp = ts.pager = { p.initializing = true; if (wo.pager_savePages && ts.storage) { t = ts.storage(table, wo.pager_storageKey) || {}; // fixes #387 - p.page = isNaN(t.page) ? p.page : t.page; + p.page = ( isNaN(t.page) ? p.page : t.page ) || p.setPage || 1; p.size = ( isNaN(t.size) ? p.size : t.size ) || p.setSize || 10; $.data(table, 'pagerLastSize', p.size); } @@ -257,9 +258,9 @@ tsp = ts.pager = { e.stopPropagation(); tsp.enablePager(table, c, true); }) - .on('destroy.pager', function(e, tmp){ + .on('destroy.pager', function(e, refreshing){ e.stopPropagation(); - tsp.destroyPager(table, c, tmp); + tsp.destroyPager(table, c, refreshing); }) .on('updateComplete.pager', function(e, table, triggered){ e.stopPropagation(); @@ -1005,15 +1006,15 @@ tsp = ts.pager = { tsp.moveToPage(table, p, true); }, - destroyPager: function(table, c, tmp){ + destroyPager: function(table, c, refreshing){ var p = c.pager; - tsp.showAllRows(table, c); p.initialized = false; - if (tmp) { return; } + c.$table.off(p.events.split(' ').join('.pager ')); + if (refreshing) { return; } + tsp.showAllRows(table, c); p.$container.hide(); // hide pager c.appender = null; // remove pager appender function delete table.config.rowsCopy; - c.$table.off(p.events.split(' ').join('.pager ')); if (ts.storage) { ts.storage(table, c.widgetOptions.pager_storageKey, ''); } diff --git a/js/widgets/widget-repeatheaders.js b/js/widgets/widget-repeatheaders.js index 3f8afd3d..b11bbe76 100644 --- a/js/widgets/widget-repeatheaders.js +++ b/js/widgets/widget-repeatheaders.js @@ -4,10 +4,10 @@ */ /*global jQuery: false */ ;(function($){ - "use strict"; + 'use strict'; $.tablesorter.addWidget({ - id: "repeatHeaders", + id: 'repeatHeaders', priority: 10, options: { rowsToSkip : 4 @@ -18,11 +18,12 @@ // cache and collect all TH headers if (!wo.repeatHeaders) { h = '