Get custom filtering active filters
Get custom filtering active filters

I'm using the following method to add custom filtering features:
$.fn.dataTable.ext.search.push(function(oSettings, aData) {});
How can I obtain back which filter value is active on each column?
Also, if I save the table state with stateSaveCallback, those filters won't be saved. This makes me think that applying custom filters this way it's completely different from use this method: table.columns(colId).search(searchString, true, false).draw(true)
But how to use the custom one as if it is the standard one?
Replies
See if this thread helps with saving and restoring the columns filters:
https://datatables.net/forums/discussion/56943
You can use
column().search()
without search parameters to get the search values. Or you can use jQuery to get the input values.Kevin
Hi @kthorngren
considering this page (which implements custom filtering) if I use the method you suggested, I only get a blank string. Even if I specify the column, I get a blank string. Try both of this in the console after filtering the age column:
$('#example').DataTable().column().search()
$('#example').DataTable().column(3).search()
Yes, thinking about it using the plugin isn't using the column().search() API to search so it would not show the result. Sorry about that. You will need to interrogate the search inputs directly with jQuery or something else. Datatables has no knowledge or control of these inputs.
Kevin