|
1 |
| -/*! Checkboxes 1.2.7 |
| 1 | +/*! Checkboxes 1.2.8 |
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.7 |
| 9 | + * @version 1.2.8 |
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
|
@@ -214,10 +214,24 @@ Checkboxes.prototype = {
|
214 | 214 | // Save previous HTML content
|
215 | 215 | $colHeader.data('html', $colHeader.html());
|
216 | 216 |
|
217 |
| - $colHeader |
218 |
| - .html('<input type="checkbox">') |
219 |
| - .addClass('dt-checkboxes-select-all') |
220 |
| - .attr('data-col', i); |
| 217 | + // If "Select all" control markup is provided |
| 218 | + if(ctx.aoColumns[i].checkboxes.selectAllRender !== null){ |
| 219 | + var selectAllHtml = ''; |
| 220 | + |
| 221 | + // If "selectAllRender" option is a function |
| 222 | + if($.isFunction(ctx.aoColumns[i].checkboxes.selectAllRender)){ |
| 223 | + selectAllHtml = ctx.aoColumns[i].checkboxes.selectAllRender(); |
| 224 | + |
| 225 | + // Otherwise, if "selectAllRender" option is a string |
| 226 | + } else if(typeof ctx.aoColumns[i].checkboxes.selectAllRender === 'string'){ |
| 227 | + selectAllHtml = ctx.aoColumns[i].checkboxes.selectAllRender; |
| 228 | + } |
| 229 | + |
| 230 | + $colHeader |
| 231 | + .html(selectAllHtml) |
| 232 | + .addClass('dt-checkboxes-select-all') |
| 233 | + .attr('data-col', i); |
| 234 | + } |
221 | 235 | }
|
222 | 236 | }
|
223 | 237 | }
|
@@ -870,7 +884,15 @@ Checkboxes.defaults = {
|
870 | 884 | * @type {Function}
|
871 | 885 | * @default `null`
|
872 | 886 | */
|
873 |
| - selectAllCallback: null |
| 887 | + selectAllCallback: null, |
| 888 | + |
| 889 | + /** |
| 890 | + * "Select all" control markup |
| 891 | + * |
| 892 | + * @type {mixed} |
| 893 | + * @default `<input type="checkbox">` |
| 894 | + */ |
| 895 | + selectAllRender: '<input type="checkbox">' |
874 | 896 | };
|
875 | 897 |
|
876 | 898 |
|
@@ -1000,7 +1022,7 @@ Api.registerPlural( 'cells().checkboxes.enable()', 'cell().checkboxes.enable()',
|
1000 | 1022 | // If data is in the list
|
1001 | 1023 | if(ctx.checkboxes.s.data[colIdx].hasOwnProperty(cellData)){
|
1002 | 1024 | // Update selection based on current state:
|
1003 |
| - // if checkbox is enabled then select row; |
| 1025 | + // if checkbox is enabled then select row; |
1004 | 1026 | // otherwise, deselect row
|
1005 | 1027 | ctx.checkboxes.updateSelect(rowIdx, state);
|
1006 | 1028 | }
|
@@ -1061,7 +1083,7 @@ Api.registerPlural( 'columns().checkboxes.selected()', 'column().checkboxes.sele
|
1061 | 1083 | * @name Checkboxes.version
|
1062 | 1084 | * @static
|
1063 | 1085 | */
|
1064 |
| -Checkboxes.version = '1.2.7'; |
| 1086 | +Checkboxes.version = '1.2.8'; |
1065 | 1087 |
|
1066 | 1088 |
|
1067 | 1089 |
|
|
0 commit comments