mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
Pager: unbind pager controls on destroy. Fixes #981
This commit is contained in:
parent
12e82fd46e
commit
d8fd020d29
@ -801,16 +801,23 @@
|
||||
},
|
||||
|
||||
destroyPager = function(table, p) {
|
||||
var c = table.config,
|
||||
namespace = c.namespace + 'pager',
|
||||
ctrls = [ p.cssFirst, p.cssPrev, p.cssNext, p.cssLast, p.cssGoto, p.cssPageSize ].join( ',' );
|
||||
showAllRows(table, p);
|
||||
p.$container.hide(); // hide pager
|
||||
var c = table.config;
|
||||
p.$container
|
||||
// hide pager controls
|
||||
.hide()
|
||||
// unbind
|
||||
.find( ctrls )
|
||||
.unbind( namespace );
|
||||
c.appender = null; // remove pager appender function
|
||||
p.initialized = false;
|
||||
delete c.rowsCopy;
|
||||
$(table).unbind( pagerEvents.split(' ').join(c.namespace + 'pager ').replace(/\s+/g, ' ') );
|
||||
c.$table.unbind( namespace );
|
||||
if (ts.storage) {
|
||||
ts.storage(table, p.storageKey, '');
|
||||
}
|
||||
delete c.pager;
|
||||
delete c.rowsCopy;
|
||||
},
|
||||
|
||||
enablePager = function(table, p, triggered) {
|
||||
@ -888,6 +895,7 @@
|
||||
p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.slice(1) + '|' + c.cssChildRow + ')');
|
||||
|
||||
$t
|
||||
// .unbind( namespace ) adding in jQuery 1.4.3 ( I think )
|
||||
.unbind( pagerEvents.split(' ').join(namespace + ' ').replace(/\s+/g, ' ') )
|
||||
.bind('filterInit filterStart '.split(' ').join(namespace + ' '), function(e, filters) {
|
||||
p.currentFilters = $.isArray(filters) ? filters : c.$table.data('lastSearch');
|
||||
|
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-pager.min.js
vendored
2
dist/js/widgets/widget-pager.min.js
vendored
File diff suppressed because one or more lines are too long
@ -144,9 +144,7 @@
|
||||
last: {},
|
||||
// save original pager size
|
||||
setSize: wo.pager_size,
|
||||
setPage: wo.pager_startPage,
|
||||
events: 'filterInit filterStart filterEnd sortEnd disablePager enablePager destroyPager updateComplete ' +
|
||||
'pageSize pageSet pageAndSize pagerUpdate refreshComplete '
|
||||
setPage: wo.pager_startPage
|
||||
}, c.pager);
|
||||
|
||||
// pager initializes multiple times before table has completed initialization
|
||||
@ -236,7 +234,7 @@
|
||||
s = wo.pager_selectors;
|
||||
|
||||
c.$table
|
||||
.off( $.trim(p.events.split(' ').join(namespace + ' ')) )
|
||||
.off( namespace )
|
||||
.on('filterInit filterStart '.split(' ').join(namespace + ' '), function(e, filters) {
|
||||
p.currentFilters = $.isArray(filters) ? filters : c.$table.data('lastSearch');
|
||||
// don't change page if filters are the same (pager updating, etc)
|
||||
@ -1073,17 +1071,25 @@
|
||||
|
||||
destroyPager: function(table, c, refreshing){
|
||||
var p = c.pager,
|
||||
s = c.widgetOptions.pager_selectors,
|
||||
ctrls = [ s.first, s.prev, s.next, s.last, s.gotoPage, s.pageSize ].join( ',' ),
|
||||
namespace = c.namespace + 'pager';
|
||||
p.initialized = false;
|
||||
c.$table.off( $.trim(p.events.split(' ').join(namespace + ' ')) );
|
||||
c.$table.off( namespace );
|
||||
p.$container
|
||||
// hide pager
|
||||
.hide()
|
||||
// unbind pager controls
|
||||
.find( ctrls )
|
||||
.off( namespace );
|
||||
if ( refreshing ) { return; }
|
||||
tsp.showAllRows(table, c);
|
||||
p.$container.hide(); // hide pager
|
||||
c.appender = null; // remove pager appender function
|
||||
delete table.config.rowsCopy;
|
||||
if (ts.storage) {
|
||||
ts.storage(table, c.widgetOptions.pager_storageKey, '');
|
||||
}
|
||||
delete table.config.pager;
|
||||
delete table.config.rowsCopy;
|
||||
},
|
||||
|
||||
enablePager: function(table, c, triggered){
|
||||
|
Loading…
Reference in New Issue
Block a user