I've been trying to get hold of the hidden column data for all filtered rows, when iterating through them.
var table = $('#'+dataTableSelector).dataTable();
table.$('tr', {"filter":"applied"}).each( function () {
var row = this;
});
Obviously row refers to the TR instance of the datatable; However, if I access the children elements of the TR, these only contain the visible columns for the row in question.
I want to access all data for the row in question, but when I try to reference the datatable, or table.row(this).node() within the each function it doesn't work - row is not a function.
How can I get all data for the rows for which filters are applied?
$(dataTableSelector).DataTable().rows( { filter: 'applied' } ).every( function () {
var row = this.data();
});
This will get the DataTable instance (where dataTableSelector is your Table ID from your HTML markup), and then get all rows that has a filter applied, and then iterate over all those rows.
Rows that do not match the filters applied (and thus are not visible in your DataTable) will not be within the results returned by rows( { filter: 'applied' } )
You can access each column of the row by row[0], row[1] etc; row will be an array of all columns, including non-visible columns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With