Not able to select the checkboxes in the table having datatables pagination
Not able to select the checkboxes in the table having datatables pagination
I'm having a table consist of more than 100 data. I have included the datatable pagination for that table.In that table i'm having checkboxes at each row and a check box at the header that is "select all" check box. If click the "select all" check box only the checkboxes in the current page getting selected and the check boxes in the remainig page is not getting selected. Same issue for unselecting the checkboxes. Can any one help me to sort out this issue.
Pagination code:
$('#data').dataTable({
"sPaginationType" : "full_numbers",
//"aLengthMenu" : [ 15, 20, 25, 50 ],
"aLengthMenu" : [ [-1, 30, 50 ], ["All", 30, 50 ] ],
"iDisplayLength" : -1,
"bDeferRender" : true,
"bAutoWidth" : false,
"oLanguage" : {
"sSearch" : "Search all columns:",
"sInfo" : "Showing START to END of TOTAL Legs"
},
"aaSorting": [[ 0, "desc" ]],
"bProcessing" : "true",
"scrollY": true,
"aoColumns": [
null,
null,
null,
null,
null,
null,
null,
null,
{ "bSearchable": false}
]
});
checkbox code:
$("#selectallcheckbox").click(function () {
$('#data tbody input[type="checkbox"]').prop('checked', this.checked);
});