How to filter on Date Range, when you have multiple tables.
How to filter on Date Range, when you have multiple tables.
The example https://datatables.net/examples/plug-ins/range_filtering.html is not a good way to filter. As the example will bind to all datatables on the page.
I have added a search above the columns and there can be multiple tables on a page. How can I bind the column filter to only the datatable search and not add it to the fn.dataTable.ext.search which effects all tables.
I have created a method that adds the column filters
using the fnInitiComplete:
fnInitComplete: function () {
this.api().columns().every(function () {
addSearchRow(this);
});
},
The addSearchRow just builds a new html element based on the search type the column needs. That is where I bind the input text to the column.search("^" + value, true, false, true).draw();
But the value there isn't designed for anything other than a regex string match.
~~~~
Answers
You can use
settings.nTable.id
to check the table id. See this example:http://live.datatables.net/tihuyiqi/1/edit
Kevin