show/hide columns inside custom search filter ($.fn.dataTable.ext.search)
show/hide columns inside custom search filter ($.fn.dataTable.ext.search)

Hi, I'm trying to figure out how to show or hide columns when the custom filter $.fn.dataTable.ext.search
is triggered:
$.fn.dataTable.ext.search.push
(
function( settings, data, dataIndex )
{
// show/hide columns in here
}
);
Is it possible?
Thanks.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Why would you show / hide columns inside a filtering function? That function is called once for every row in the table on a search action. It could be done (
new $.fn.dataTable.Api(settings).column(...).visible(...)
), but it seems hugely inefficient.I don’t actually understand what the goal is here I’m afraid?
Allan
Oh I see what you mean, you're right my bad, I only want to show it once if selected filter is active.
Like:
Thanks!
I'm with you now - thanks for the explanation. And I agree - that listener would be a good way to do it.
Allan