Skip to content

Commit a4f5edf

Browse files
committed
Fix #56: Corrected issue with event handler not being detached after table is destroyed
1 parent e941220 commit a4f5edf

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

js/dataTables.checkboxes.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@
7474
this.s = {
7575
dt: new DataTable.Api( settings ),
7676
columns: [],
77-
data: {},
78-
dataDisabled: {},
77+
data: [],
78+
dataDisabled: [],
7979
ignoreSelect: false
8080
};
8181

@@ -86,7 +86,7 @@
8686
if ( this.s.ctx.checkboxes ) {
8787
return;
8888
}
89-
89+
9090
settings.checkboxes = this;
9191

9292
this._constructor();
@@ -360,11 +360,12 @@
360360
// Handle Ajax request completion event
361361
// NOTE: Needed to update table state
362362
// if table is reloaded via ajax.reload() API method
363-
$table.on('xhr.dt', function ( /* e, settings , json, xhr */ ) {
363+
$table.on('xhr.dt.dtCheckboxes', function ( /* e, settings , json, xhr */ ) {
364364
// For every column where checkboxes are enabled
365365
$.each(self.s.columns, function(index, colIdx){
366366
// Clear data
367367
self.s.data[colIdx] = {};
368+
self.s.dataDisabled[colIdx] = {};
368369
});
369370

370371
// If state saving is enabled

0 commit comments

Comments
 (0)