Q:

how to access a row of whole datatable at the same time in jquery

I use the DataTables jQuery plugin. In that DataTable I have created a check box in the header and every column has a check box too.
That DataTable has a few pages. What I need is when I check the header checkbox then all checkboxes should be checked in all the pages of the DataTable.
I have to access the rows of all pages at a same time.
I tried this
if($('#selectAll').is(':checked')){
    $(nRow).find(':input[name=group_select_components]').iCheck('check');
}

I can check the checkboxes when I will click the paginate. But I want to access a row of the dataTable at the same time..

A:

Try the below code!!
if($('#selectAll').is(':checked')){
    var table = $('#yourTableId').DataTable();
    var cells = table
        .cells( ":checkbox" )
        .nodes();
    $(cells).iCheck('check');
}

or this
if($('#selectAll').is(':checked')){
    var table = $('#yourTableId').DataTable();
    $(':checkbox', table.rows().nodes()).iCheck('check');
}

