I know this might seem primitive, but I\'ve been trying to implement it for a whole day, maybe because I can\'t fully comprehend how to use the API, I\'m using DataTables 1.
It really isn't that hard, but without seeing your markup I can only provide a generic example -
$('input[value="Check All"]').click(function() { // a button with Check All as its value
$(':checkbox').prop('checked', true); // all checkboxes, you can narrow with a better selector
});
This should work for you
var table = $('#numbers_table').DataTable();
$('#checkall').click(function () {
$(':checkbox', table.rows().nodes()).prop('checked', this.checked);
});
if does not work try using api() keyword:
$('#YourCheckBoxId').on('click', function () {
var rows = YourDatatableVariable.api().rows({ 'search': 'applied' }).nodes();
$('input[type="checkbox"]', rows).prop('checked', this.checked);
});
Try this code:
var table = $('#numbers_table').DataTable();
var cells = table
.cells( ":checkbox" )
.nodes();
$( cells ).prop('checked', true);
Source.