mardi 29 septembre 2015

Using select all script for filtered table

I am using this (file here) script and i am using check all script in first row for my checkboxes. But first when I filtered for a column, this script selected checkboxes at 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 for your helps.




Aucun commentaire:

Enregistrer un commentaire