How can I get filtered (AND paged) data?

How can I get filtered (AND paged) data?

robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0

I use this line of code to get the filtered data from a datatable.

var aaData = settings.$dataTable._('tr', { "filter": "applied" });

I want the paging to apply so that I get only the rows that are currently displayed, based on filtering and paging.

How can I do this? Thank you very much!

Answers

  • DaimianDaimian Posts: 62Questions: 1Answers: 15

    Best option is via the new API. Here is a code example:

    var table = $("#table").DataTable();
    
    console.log(table.rows({order: "applied", search: "applied", page: "current"}).data());
    

    This uses the selector-modifier with the rows() API method.

  • robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
    edited July 2014

    Using 1.9, the answer is:

    var aaData = settings.$dataTable._('tr', { "filter": "applied", "page": "current" });

    It just took my some time to find the right documentation for 1.9.

    The question should be closed.

This discussion has been closed.