Column visibility with regular expression
Column visibility with regular expression
I have seen the default column visibility with the standard api at
https://datatables.net/examples/api/show_hide.html
and I have seen the extended version using the buttons extension linked on the same page.
My use case is a little different in that I need to take a regular expression from a single input, similar to row filtering, and turn on and off columns whose names match the filter.
Has anyone done this, and if not, is this possible with the current api?
This question has accepted answers - jump to:
Answers
I think you will need to loop over every column and check for a match manually.
https://datatables.net/reference/api/columns().every()
This is correct. The other option would be use to
column-selector
as a function (when you usecolumns()
) which would let you execute your regex as part of the selector.Allan