mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Pager: Prevent js error on successive removal calls. Fixes #1155
This commit is contained in:
parent
bbe8be96c8
commit
5560f12011
@ -436,7 +436,7 @@
|
||||
},
|
||||
|
||||
updatePageDisplay: function( c, completed ) {
|
||||
if ( c.pager.initializing ) { return; }
|
||||
if ( c.pager && c.pager.initializing ) { return; }
|
||||
var s, t, $out, options, indx, len,
|
||||
table = c.table,
|
||||
wo = c.widgetOptions,
|
||||
@ -1165,25 +1165,32 @@
|
||||
destroyPager: function( c, refreshing ) {
|
||||
var table = c.table,
|
||||
p = c.pager,
|
||||
s = c.widgetOptions.pager_selectors,
|
||||
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( namespace );
|
||||
p.$container
|
||||
// hide pager
|
||||
.hide()
|
||||
// unbind pager controls
|
||||
.find( ctrls )
|
||||
.off( namespace );
|
||||
if ( refreshing ) { return; }
|
||||
tsp.showAllRows( c );
|
||||
c.appender = null; // remove pager appender function
|
||||
if ( ts.storage ) {
|
||||
ts.storage( table, c.widgetOptions.pager_storageKey, '' );
|
||||
// check pager object in case two successive pager destroys are triggered
|
||||
// e.g. "destroyPager" then "removeWidget" - see #1155
|
||||
if ( p ) {
|
||||
p.initialized = false;
|
||||
c.$table.off( namespace );
|
||||
p.$container
|
||||
// hide pager
|
||||
.hide()
|
||||
// unbind pager controls
|
||||
.find( ctrls )
|
||||
.off( namespace );
|
||||
if ( refreshing ) { return; }
|
||||
c.appender = null; // remove pager appender function
|
||||
tsp.showAllRows( c );
|
||||
if ( ts.storage ) {
|
||||
ts.storage( table, c.widgetOptions.pager_storageKey, '' );
|
||||
}
|
||||
p.$container = null;
|
||||
p.$goto = null;
|
||||
p.$size = null;
|
||||
c.pager = null;
|
||||
c.rowsCopy = null;
|
||||
}
|
||||
delete table.config.pager;
|
||||
delete table.config.rowsCopy;
|
||||
},
|
||||
|
||||
enablePager: function( c, triggered ) {
|
||||
|
Loading…
Reference in New Issue
Block a user