javascript - Using select all script for filtered table -
i using this (file here) script , using check script in first row checkboxes. first when filtered column, script selected checkboxes @ hidden rows, too.
$(document).ready(function(){ $('#select_all').on('click',function(){ if(this.checked){ $('.checkbox').each(function(){ this.checked = true; }); }else{ $('.checkbox').each(function(){ this.checked = false; }); } }); $('.checkbox').on('click',function(){ if($('.checkbox:checked').length == $('.checkbox').length){ $('#select_all').prop('checked',true); }else{ $('#select_all').prop('checked',false); } }); });
thanks helps.
use jquery :visible
selector leave out checkboxes have been filtered. https://api.jquery.com/visible-selector/
$('#select_all').on('click',function(){ var docheck = this.checked; $('.checkbox:visible').each(function(){ this.checked = docheck; }); });
Comments
Post a Comment