1
- /*! Checkboxes 1.0.1
1
+ /*! Checkboxes 1.0.2
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.0.1
9
+ * @version 1.0.2
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
@@ -161,9 +161,11 @@ Checkboxes.prototype = {
161
161
// EVENT HANDLERS
162
162
//
163
163
var $table = $ ( dt . table ( ) . node ( ) ) ;
164
+ var $table_body = $ ( dt . table ( ) . body ( ) ) ;
165
+ var $table_header = $ ( dt . table ( ) . header ( ) ) ;
164
166
165
167
// Handles checkbox click event
166
- $ ( 'tbody' , $table ) . on ( 'click' , 'input[type="checkbox"]' , function ( e ) {
168
+ $table_body . on ( 'click' , 'input[type="checkbox"]' , function ( e ) {
167
169
self . onClick ( e , this ) ;
168
170
} ) ;
169
171
@@ -178,7 +180,7 @@ Checkboxes.prototype = {
178
180
179
181
// Otherwise, if Select extension is not available
180
182
} else {
181
- $ ( 'tbody' , $table ) . on ( 'click' , 'td' , function ( ) {
183
+ $table_body . on ( 'click' , 'td' , function ( ) {
182
184
var $row = $ ( this ) . closest ( 'tr' ) ;
183
185
var e = {
184
186
type : ( $row . hasClass ( 'selected' ) ? 'deselect' : 'select' )
@@ -197,12 +199,12 @@ Checkboxes.prototype = {
197
199
} ) ;
198
200
199
201
// Handle click on "Select all" control
200
- $ ( 'thead' , $table ) . on ( 'click' , 'th.checkboxes-select-all input[type="checkbox"]' , function ( e ) {
202
+ $table_header . on ( 'click' , 'th.checkboxes-select-all input[type="checkbox"]' , function ( e ) {
201
203
self . onClickSelectAll ( e , this ) ;
202
204
} ) ;
203
205
204
206
// Handle click on heading containing "Select all" control
205
- $ ( 'thead' , $table ) . on ( 'click' , 'th.checkboxes-select-all' , function ( e ) {
207
+ $table_header . on ( 'click' , 'th.checkboxes-select-all' , function ( e ) {
206
208
$ ( 'input[type="checkbox"]' , this ) . trigger ( 'click' ) ;
207
209
} ) ;
208
210
}
0 commit comments