1
- /*! Checkboxes 1.2.9
1
+ /*! Checkboxes 1.2.10-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.9
9
+ * @version 1.2.10-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
@@ -1067,18 +1067,34 @@ Api.registerPlural( 'columns().checkboxes.deselectAll()', 'column().checkboxes.d
1067
1067
} ) ;
1068
1068
1069
1069
Api . registerPlural ( 'columns().checkboxes.selected()' , 'column().checkboxes.selected()' , function ( ) {
1070
- return this . iterator ( 'column' , function ( ctx , colIdx ) {
1070
+ return this . iterator ( 'column-rows' , function ( ctx , colIdx , i , j , rowsIdx ) {
1071
+ // If Checkboxes extension is enabled for this column
1071
1072
if ( ctx . aoColumns [ colIdx ] . checkboxes ) {
1073
+ // Prepare a list of all cells
1074
+ var selector = [ ] ;
1075
+ $ . each ( rowsIdx , function ( index , rowIdx ) {
1076
+ selector . push ( { row : rowIdx , column : colIdx } ) ;
1077
+ } ) ;
1078
+
1079
+ // Get all cells data
1080
+ var cells = this . cells ( selector ) ;
1081
+ var cellsData = cells . data ( ) ;
1082
+
1072
1083
var data = [ ] ;
1073
1084
1074
- $ . each ( ctx . checkboxes . s . data [ colIdx ] , function ( cellData , countRows ) {
1075
- // If checkbox in the cell can be checked
1076
- if ( ctx . checkboxes . isCellSelectable ( colIdx , cellData ) ) {
1077
- data . push ( cellData ) ;
1085
+ // Enumerate all cells data
1086
+ $ . each ( cellsData , function ( index , cellData ) {
1087
+ // If checkbox is checked
1088
+ if ( ctx . checkboxes . s . data [ colIdx ] . hasOwnProperty ( cellData ) ) {
1089
+ // If checkbox in the cell can be selected
1090
+ if ( ctx . checkboxes . isCellSelectable ( colIdx , cellData ) ) {
1091
+ data . push ( cellData ) ;
1092
+ }
1078
1093
}
1079
1094
} ) ;
1080
1095
1081
1096
return data ;
1097
+
1082
1098
} else {
1083
1099
return [ ] ;
1084
1100
}
@@ -1092,7 +1108,7 @@ Api.registerPlural( 'columns().checkboxes.selected()', 'column().checkboxes.sele
1092
1108
* @name Checkboxes.version
1093
1109
* @static
1094
1110
*/
1095
- Checkboxes . version = '1.2.9 ' ;
1111
+ Checkboxes . version = '1.2.10-dev ' ;
1096
1112
1097
1113
1098
1114
0 commit comments