Skip to content Skip to sidebar Skip to footer

Checkboxes Will Only Work On Current Pagination Page In JQuery Datatables

I am using jquery data table for listing my content which have checkbox selection and selected content post the data but in submitted form only current page data sent. My Data tabl

Solution 1:

you can get all the selected check box values using following code this might be helpful for you

var myArray = [];
var id = "";
var oTable = $("#example").dataTable();
$(".class1:checked", oTable.fnGetNodes()).each(function() {
    if (id != "") {
        id = id + "," + $(this).val();
    } else {
        id = $(this).val();
    }
});

Solution 2:

You can check them at the end.

var table = $("#yourtablename").DataTable({
    //your datatable options(optional)
});

Now jQuery have access to all the rows by following code

  table.$('td > input:checkbox').each(function () {
            // If checkbox is checked
            if (this.checked) {
             //Your code for example
                alert($(this).attr('name'));
            }
    }); 

Post a Comment for "Checkboxes Will Only Work On Current Pagination Page In JQuery Datatables"