1
- /*! Checkboxes 1.2.5
1
+ /*! Checkboxes 1.2.6
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
9
+ * @version 1.2.6
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
@@ -309,27 +309,32 @@ Checkboxes.prototype = {
309
309
310
310
// Handle table initialization event
311
311
$table . on ( 'init.dt.dtCheckboxes' , function ( ) {
312
+ // If server-side processing mode is not enabled
313
+ // NOTE: Needed to avoid duplicate call to updateCheckboxes() in onDraw()
314
+ if ( ! ctx . oFeatures . bServerSide ) {
312
315
313
- // If state saving is enabled
314
- if ( ctx . oFeatures . bStateSave ) {
315
-
316
- // If server-side processing mode is not enabled
317
- // NOTE: Needed to avoid duplicate call to updateCheckboxes() in onDraw()
318
- if ( ! ctx . oFeatures . bServerSide ) {
319
-
316
+ // If state saving is enabled
317
+ if ( ctx . oFeatures . bStateSave ) {
320
318
self . updateState ( ) ;
319
+ }
320
+
321
+ // Handle Ajax request completion event
322
+ // NOTE: Needed to update table state
323
+ // if table is reloaded via ajax.reload() API method
324
+ $table . on ( 'xhr.dt' , function ( e , settings , json , xhr ) {
325
+ // For every column where checkboxes are enabled
326
+ $ . each ( self . s . columns , function ( index , colIdx ) {
327
+ // Clear data
328
+ self . s . data [ colIdx ] = { } ;
329
+ } ) ;
321
330
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 ) {
331
+ // If state saving is enabled
332
+ if ( ctx . oFeatures . bStateSave ) {
326
333
// Retrieve stored state
327
334
var state = dt . state . loaded ( ) ;
328
335
336
+ // For every column where checkboxes are enabled
329
337
$ . each ( self . s . columns , function ( index , colIdx ) {
330
- // Clear data
331
- self . s . data [ colIdx ] = { } ;
332
-
333
338
// If state is loaded and contains data for this column
334
339
if ( state && state . checkboxes && state . checkboxes . hasOwnProperty ( colIdx ) ) {
335
340
// Load previous state
@@ -341,9 +346,12 @@ Checkboxes.prototype = {
341
346
$table . one ( 'draw.dt.dtCheckboxes' , function ( e ) {
342
347
self . updateState ( ) ;
343
348
} ) ;
344
- } ) ;
345
- }
349
+ }
350
+ } ) ;
351
+ }
346
352
353
+ // If state saving is enabled
354
+ if ( ctx . oFeatures . bStateSave ) {
347
355
// Handle state saving event
348
356
$table . on ( 'stateSaveParams.dt.dtCheckboxes' , function ( e , settings , data ) {
349
357
// Store data associated with this plug-in
@@ -975,7 +983,7 @@ Api.registerPlural( 'columns().checkboxes.selected()', 'column().checkboxes.sele
975
983
* @name Checkboxes.version
976
984
* @static
977
985
*/
978
- Checkboxes . version = '1.2.5 ' ;
986
+ Checkboxes . version = '1.2.6 ' ;
979
987
980
988
981
989
0 commit comments