问题
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
回答1:
Ok, it worked like this:
$("#table_paginate").click(function () {
if($('#select-all').is(":checked")){
$(".bulk-checkbox").prop("checked", "true");
}
else {
$(".bulk-checkbox").removeAttr('checked');
}
});
来源:https://stackoverflow.com/questions/32561659/select-all-rows-while-using-pagination