How to stop searching on hidden column dynamically
How to stop searching on hidden column dynamically
deepak_gedia
Posts: 2Questions: 1Answers: 0
We have a requirement where we need to show hide column on click of checkbox and if the column is hidden it should not appear in search
I have written the below code but still it is searching in hidden column
oTable.columns(totalColumns).data().search($(this).val()).draw();
so totalColumn is an array of visible column number.
is there any way where i can search only on visible column?
This question has an accepted answers - jump to answer
Answers
The ability to change whether a column is searchable or not is not dynamic I'm sorry to say. The only way to do that is to destroy the table and recreate it with the new searchable options set.
I suppose the there is one other option - this feature could be added to DataTables. If so do so, a pull request would be welcomed.
Allan
Hello Thank you so much for the suggession.
it worked, I destroyed without clearing the tables and reinitialized it with same settings and added new column definition with search columns and it worked