Customized search applicable to both normal datatable and datatable with child rows.
Customized search applicable to both normal datatable and datatable with child rows.
Atish
Posts: 6Questions: 2Answers: 0
I have an application with two datatables.
1.Has only parent rows (no child rows) say datatable1.
2.Has parent rows as well as child rows say datatable2.
I want to implement only one search for both the datatables.
For the datatable2 I implemented davidkonrad's answer on this link: https://stackoverflow.com/questions/30471089/datatables-search-child-row-content/ which works fine.
But the search does not work for the datatable2.
Any help would be greatly appreciated.
Thank you.
This discussion has been closed.
Answers
Clever approach!
You could do something like this:
Assuming your second (non child) table is assigned to the variable
table2
.Kevin
table2.search(this.value).draw(); was giving me a error but table2.fnFilter(this.value); worked for me.
Thanks for the help.
How can I search in two tables so that for 1st table I want datatables default search functionality and for second I want my custom search?
In my project when I implemented custom search,even when I enter some text in 1st table's search field it was searching in second table.I think this is because of '.dataTables_filter input' class which is same for both search fields of both tables.
Thank you.
You can use a selector like this for a specific table:
$('#myTable_filter input')
.Kevin