|
1 | | -/*! Checkboxes 1.2.5-dev |
| 1 | +/*! Checkboxes 1.2.5 |
2 | 2 | * Copyright (c) Gyrocode (www.gyrocode.com) |
3 | 3 | * License: MIT License |
4 | 4 | */ |
5 | 5 |
|
6 | 6 | /** |
7 | 7 | * @summary Checkboxes |
8 | 8 | * @description Checkboxes extension for jQuery DataTables |
9 | | - * @version 1.2.5-dev |
| 9 | + * @version 1.2.5 |
10 | 10 | * @file dataTables.checkboxes.js |
11 | 11 | * @author Gyrocode (http://www.gyrocode.com/projects/jquery-datatables-checkboxes/) |
12 | 12 | * @contact http://www.gyrocode.com/contacts |
@@ -265,35 +265,6 @@ Checkboxes.prototype = { |
265 | 265 | }); |
266 | 266 | } |
267 | 267 |
|
268 | | - // Handle Ajax request completion event |
269 | | - $table.on('xhr.dt', function ( e, settings, json, xhr ) { |
270 | | - // Retrieve stored state |
271 | | - var state = dt.state.loaded(); |
272 | | - |
273 | | - $.each(self.s.columns, function(index, colIdx){ |
274 | | - // Clear data |
275 | | - self.s.data[colIdx] = {}; |
276 | | - |
277 | | - // If state is loaded and contains data for this column |
278 | | - if(state && state.checkboxes && state.checkboxes.hasOwnProperty(colIdx)){ |
279 | | - // Load previous state |
280 | | - self.s.data[colIdx] = state.checkboxes[colIdx]; |
281 | | - } |
282 | | - }); |
283 | | - |
284 | | - // If state saving is enabled |
285 | | - if(ctx.oFeatures.bStateSave){ |
286 | | - // If server-side processing mode is not enabled |
287 | | - // NOTE: Needed to avoid duplicate call to updateCheckboxes() in onDraw() |
288 | | - if(!ctx.oFeatures.bServerSide){ |
289 | | - // Update table state on next redraw |
290 | | - $table.one('draw.dt.dtCheckboxes', function(e){ |
291 | | - self.updateState(); |
292 | | - }); |
293 | | - } |
294 | | - } |
295 | | - }); |
296 | | - |
297 | 268 | // Handle table draw event |
298 | 269 | $table.on('draw.dt.dtCheckboxes', function(e){ |
299 | 270 | self.onDraw(e); |
@@ -345,7 +316,32 @@ Checkboxes.prototype = { |
345 | 316 | // If server-side processing mode is not enabled |
346 | 317 | // NOTE: Needed to avoid duplicate call to updateCheckboxes() in onDraw() |
347 | 318 | if(!ctx.oFeatures.bServerSide){ |
| 319 | + |
348 | 320 | self.updateState(); |
| 321 | + |
| 322 | + // Handle Ajax request completion event |
| 323 | + // NOTE: Needed to update table state |
| 324 | + // if table is reloaded via ajax.reload() API method |
| 325 | + $table.on('xhr.dt', function ( e, settings, json, xhr ) { |
| 326 | + // Retrieve stored state |
| 327 | + var state = dt.state.loaded(); |
| 328 | + |
| 329 | + $.each(self.s.columns, function(index, colIdx){ |
| 330 | + // Clear data |
| 331 | + self.s.data[colIdx] = {}; |
| 332 | + |
| 333 | + // If state is loaded and contains data for this column |
| 334 | + if(state && state.checkboxes && state.checkboxes.hasOwnProperty(colIdx)){ |
| 335 | + // Load previous state |
| 336 | + self.s.data[colIdx] = state.checkboxes[colIdx]; |
| 337 | + } |
| 338 | + }); |
| 339 | + |
| 340 | + // Update table state on next redraw |
| 341 | + $table.one('draw.dt.dtCheckboxes', function(e){ |
| 342 | + self.updateState(); |
| 343 | + }); |
| 344 | + }); |
349 | 345 | } |
350 | 346 |
|
351 | 347 | // Handle state saving event |
@@ -505,7 +501,6 @@ Checkboxes.prototype = { |
505 | 501 | var ctx = self.s.ctx; |
506 | 502 |
|
507 | 503 | // Enumerate all cells |
508 | | - var dataSeen = {}; |
509 | 504 | dt.cells('tr', self.s.columns, opts).every(function(cellRow, cellCol){ |
510 | 505 | // Get cell data |
511 | 506 | var cellData = this.data(); |
@@ -980,7 +975,7 @@ Api.registerPlural( 'columns().checkboxes.selected()', 'column().checkboxes.sele |
980 | 975 | * @name Checkboxes.version |
981 | 976 | * @static |
982 | 977 | */ |
983 | | -Checkboxes.version = '1.2.5-dev'; |
| 978 | +Checkboxes.version = '1.2.5'; |
984 | 979 |
|
985 | 980 |
|
986 | 981 |
|
|
0 commit comments