How to synchronize search between datatables?
How to synchronize search between datatables?
Ruudscorner
Posts: 2Questions: 2Answers: 0
Between multiple datatables I want it so that when one writes something in the "Search" box then that search text will be applied on all datatables. I tried this:
$(".dataTables_filter input").keyup(function () {
$(".dataTables_filter input").val($(this).val());
});
The text gets copied to all the datatables, but does not take effect. It also gets cleared when the datatable reloads content.
This discussion has been closed.
Answers
Use
search()
rather than writing the value to the input. You could do that - you just need to trigger thechange
event, but I generally would suggest using the API.Allan
You probably want to add a check so it doesn't change the value of the input that triggered the search as well!