1

I have implemented jQuery datatables with pagination enabled.I want to select multiple rows via radio buttons from any random pages and want to perform some action on them on a click of a button.

My current implementation processes the selection of the current page begin viewed but doesn't process the rest.

I want to process all records form every page at once. Please Help,

Here's my button click event code:

$('#mastersave').click(function() {

    $('#mastertable tr').filter(':has(:checkbox:checked)').each(function() {
        $tr = $(this);
         ..............
         //Do some operations
         ...............

    });
});

2 Answers 2

1

Try this code, get all input:checked in your table, use fnGetNodes function.

var oTable = $('#mastertable').dataTable();

$('#mastersave').click(function() {
    $("input:checked", oTable.fnGetNodes()).each(function(){

          var $tr = $(this).closest("tr");

          //Do some operations

    });
});
Sign up to request clarification or add additional context in comments.

Comments

1

There is an update to Data Tables. In DataTables v1.10 the function names have changed. So the fnGetNodes function won't work and will give error: .fnGetNodes is not a function. Use table.rows().nodes() for reference https://datatables.net/reference/api/rows().nodes()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.