Capture Filtered Rows - How To?

Capture Filtered Rows - How To?

JoyrexJoyrex Posts: 92Questions: 14Answers: 3
edited October 2013 in DataTables 1.9
I'm trying to capture the rows that are showing after a user has filtered the recordset (this is NOT using server-side data) so I can use a values from the filtered rows for pagination on a detail view of those records (so the user can paginate through only the filtered data instead of the entire recordset). Any ideas or direction where I would accomplish this? I've read up on filtering by rows and columns, but nothing's clicking for me. Any help is appreciated!

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    So you want the data from the rows that remain after filtering? The `_` method will do that: `table._( 'tr', { 'filter': 'applied' } );` . Docs: http://datatables.net/docs/DataTables/1.9.4/#_

    Allan
  • JoyrexJoyrex Posts: 92Questions: 14Answers: 3
    Allan,

    Ah, OK - I'll give this a go! Thanks!
  • JoyrexJoyrex Posts: 92Questions: 14Answers: 3
    edited November 2013
    OK, I understand now how this works (I think) - I get a list of filtered items (the first td in each filtered row), but two things still remain elusive to me:
    - how to trigger this when someone filters the table - right now it runs immediately and the only way I can see what is being captured is via an alert, and I set the fnFilter value to something - how do I trigger it so it only captures when someone uses the filter?
    - the results come back as a comma-delimited list - is there any way of appending the data to any hrefs that also exist in the filtered data with the data? I'm trying to pass the comma-delimited list of filtered records via a URL parameter to another page so I can use that as my pagination range on the new page. The documentation says the oOpts "Optional parameters for modifying the rows to be included" object can be used for that - is that correct?

    Thanks again for the help!
This discussion has been closed.