Select all rows when using pagination

I have a table and SELECT ALL. I use Bootstrap DataTable to paginate, and I would like SELECT ALL to select all rows on the pages. Is it possible and how?

I use this, but it only works when I return to this page, and 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
source share
1 answer

Well, it worked as follows:

 $("#table_paginate").click(function () { if($('#select-all').is(":checked")){ $(".bulk-checkbox").prop("checked", "true"); } else { $(".bulk-checkbox").removeAttr('checked'); } }); 
+1
source

Source: https://habr.com/ru/post/973812/


All Articles