mardi 29 mars 2016

check box not working with datatable.js pagination's second page

I am using datatable.js for pagination:

When I check a checkbox inside table row, I have to show Lock/Delete buttons which are out side the table. For this I have Done Below jQuery Code:

 $(document).ready(function () {      

    $('#tblID :input[type="checkbox"]').on('click',function () {
        var checkedBoxes = $('#tblID:input[type="checkbox"]:checked').length;

        if (checkedBoxes > 0) {
            alert(checkedBoxes);
            $("#lnkLock").show();
            $("#lnkDelete").show();

        }
        else {
            alert(checkedBoxes);
            $("#lnkLock").hide();
            $("#lnkDelete").hide();
        }
    });
 });

It is working Only on The First Page of table.When I navigate to second page of datatable /Table it stops working(Buttons (lock/delete)) are not shown.

On second, third...pages checkbox click event is also not fired.

How can I do it on other pages?




Aucun commentaire:

Enregistrer un commentaire