Skip to content

Commit 22f0c8b

Browse files
committed
Fixed #18: Added preliminary support for FixedHeader extension
1 parent 510b05f commit 22f0c8b

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

js/dataTables.checkboxes.js

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/*! Checkboxes 1.1.0-dev
1+
/*! Checkboxes 1.1.0-alpha.1
22
* Copyright (c) Gyrocode (www.gyrocode.com)
33
* License: MIT License
44
*/
55

66
/**
77
* @summary Checkboxes
88
* @description Checkboxes extension for jQuery DataTables
9-
* @version 1.1.0-dev
9+
* @version 1.1.0-alpha.1
1010
* @file dataTables.checkboxes.js
1111
* @author Gyrocode (http://www.gyrocode.com/projects/jquery-datatables-checkboxes/)
1212
* @contact http://www.gyrocode.com/contacts
@@ -230,6 +230,28 @@ Checkboxes.prototype = {
230230
$tableContainer.on('click', 'thead th.dt-checkboxes-select-all', function(e) {
231231
$('input[type="checkbox"]', this).trigger('click');
232232
});
233+
234+
// Handle click on "Select all" control in floating fixed header
235+
$(document).on('click', '.fixedHeader-floating thead th.dt-checkboxes-select-all input[type="checkbox"]', function(e){
236+
// If FixedHeader is enabled in this instance
237+
if(ctx._fixedHeader){
238+
// If header is floating in this instance
239+
if(ctx._fixedHeader.dom['header'].floating){
240+
self.onClickSelectAll(e, this);
241+
}
242+
}
243+
});
244+
245+
// Handle click on heading containing "Select all" control in floating fixed header
246+
$(document).on('click', '.fixedHeader-floating thead th.dt-checkboxes-select-all', function(e) {
247+
// If FixedHeader is enabled in this instance
248+
if(ctx._fixedHeader){
249+
// If header is floating in this instance
250+
if(ctx._fixedHeader.dom['header'].floating){
251+
$('input[type="checkbox"]', this).trigger('click');
252+
}
253+
}
254+
});
233255
}
234256
},
235257

@@ -554,6 +576,14 @@ Checkboxes.prototype = {
554576
var $checkboxesChecked = dt.$(cells.nodes()).find('.dt-checkboxes:checked');
555577
var $checkboxesSelectAll = $('.dt-checkboxes-select-all[data-col="' + colIdx + '"] input[type="checkbox"]', $tableContainer);
556578

579+
// If FixedHeader is enabled in this instance
580+
if(ctx._fixedHeader){
581+
// If header is floating in this instance
582+
if(ctx._fixedHeader.dom['header'].floating){
583+
$checkboxesSelectAll = $('.fixedHeader-floating .dt-checkboxes-select-all[data-col="' + colIdx + '"] input[type="checkbox"]');
584+
}
585+
}
586+
557587
// If none of the checkboxes are checked
558588
if ($checkboxesChecked.length === 0) {
559589
$checkboxesSelectAll.prop({

0 commit comments

Comments
 (0)