|
1 |
| -/*! Checkboxes 1.2.10 |
| 1 | +/*! Checkboxes 1.2.11-dev |
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.10 |
| 9 | + * @version 1.2.11-dev |
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
|
|
392 | 392 | }
|
393 | 393 | });
|
394 | 394 | }
|
395 |
| - |
396 |
| - // If state saving is enabled |
397 |
| - if(ctx.oFeatures.bStateSave){ |
398 |
| - // Handle state saving event |
399 |
| - $table.on('stateSaveParams.dt.dtCheckboxes', function (e, settings, data){ |
400 |
| - // Initialize array holding checkbox state for each column |
401 |
| - data.checkboxes = []; |
402 |
| - |
403 |
| - // For every column where checkboxes are enabled |
404 |
| - $.each(self.s.columns, function(index, colIdx){ |
405 |
| - // If checkbox state saving is enabled |
406 |
| - if(ctx.aoColumns[colIdx].checkboxes.stateSave){ |
407 |
| - // Store data associated with this plug-in |
408 |
| - data.checkboxes[colIdx] = self.s.data[colIdx]; |
409 |
| - } |
410 |
| - }); |
411 |
| - }); |
412 |
| - } |
413 | 395 | });
|
414 | 396 |
|
| 397 | + // If state saving is enabled |
| 398 | + if(ctx.oFeatures.bStateSave){ |
| 399 | + // Handle state saving event |
| 400 | + $table.on('stateSaveParams.dt.dtCheckboxes', function (e, settings, data) { |
| 401 | + self.onStateSave(e, settings, data); |
| 402 | + }); |
| 403 | + } |
| 404 | + |
415 | 405 | // Handle table destroy event
|
416 | 406 | $table.one('destroy.dt.dtCheckboxes', function(){
|
417 | 407 | // Detach event handlers
|
|
680 | 670 | });
|
681 | 671 | },
|
682 | 672 |
|
| 673 | + // Handles state save event |
| 674 | + onStateSave: function (e, settings, data) { |
| 675 | + var self = this; |
| 676 | + var ctx = self.s.ctx; |
| 677 | + |
| 678 | + // Initialize array holding checkbox state for each column |
| 679 | + data.checkboxes = []; |
| 680 | + |
| 681 | + // For every column where checkboxes are enabled |
| 682 | + $.each(self.s.columns, function(index, colIdx){ |
| 683 | + // If checkbox state saving is enabled |
| 684 | + if(ctx.aoColumns[colIdx].checkboxes.stateSave){ |
| 685 | + // Store data associated with this plug-in |
| 686 | + data.checkboxes[colIdx] = self.s.data[colIdx]; |
| 687 | + } |
| 688 | + }); |
| 689 | + }, |
| 690 | + |
683 | 691 | // Updates state of the "Select all" controls
|
684 | 692 | updateSelectAll: function(colIdx){
|
685 | 693 | var self = this;
|
|
1155 | 1163 | * @name Checkboxes.version
|
1156 | 1164 | * @static
|
1157 | 1165 | */
|
1158 |
| - Checkboxes.version = '1.2.10'; |
| 1166 | + Checkboxes.version = '1.2.11-dev'; |
1159 | 1167 |
|
1160 | 1168 |
|
1161 | 1169 |
|
|
0 commit comments