Select all rows while using pagination

℡╲_俬逩灬. 提交于 2019-12-11 11:47:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!