Reputation: 2867
I have a table and SELECT ALL checkbox. I am using Bootstrap DataTable to paginate through table and I would like SELECT ALL to select all rows across the pages. Is that possible and how?
I use this, but it works only when I return to that page, not when I first click on it.
$("#table").on( 'page.dt', function () {
if($('#select-all').is(":checked")){
$(".bulk-checkbox").prop("checked", "true");
}
else {
$(".bulk-checkbox").removeAttr('checked');
}
});
Thanks
Upvotes: 1
Views: 4908
Reputation: 2867
Ok, it worked like this:
$("#table_paginate").click(function () {
if($('#select-all').is(":checked")){
$(".bulk-checkbox").prop("checked", "true");
}
else {
$(".bulk-checkbox").removeAttr('checked');
}
});
Upvotes: 1