How to search in only one table when multiple tables exist.
How to search in only one table when multiple tables exist.
hwyckoff
Posts: 19Questions: 7Answers: 1
I have a jQuery function with these variable definitions:
var oTable = $(".display").DataTable();
var table1 = oTable.table("#InterventionAverage");
var table2 = oTable.table("#InterventionSummary");
var table3 = oTable.table("#InterventionDetails");
And while I can do column visibility code, like this:
table1.column(3).visible(false, false);
I cannot do specific searching within only one table.
var selection = getMergedSelections();
table3.search(selection.join('|'), true, false, true);
How can I search only within a specific table?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm not sure what your search term is and if it will work but you do need to update the search display by drawing the table. Try this:
table3.search(selection.join('|'), true, false, true).draw();
This is from the
search()
docs:Kevin
I did it as you wrote, and it's still not working.
@kthorngren -- Here's a twist. When I do this:
The search applies on table 2 but not table 3.
Seems to work here:
http://live.datatables.net/gasepoci/1/edit
Maybe you can update my test case with your specifics.
Kevin
@kthorngren -- It was a rookie mistake on my part. The table ID was actually assigned to the outer div. Rookie mistake and I finally saw it after taking a walk from the computer.
Happens all the time.
Kevin