Search/Filter only visible columns

Search/Filter only visible columns

cyberlussicyberlussi Posts: 6Questions: 0Answers: 0
edited August 2011 in General
Hi,

I hope this is not a double post ... but I could not find a matching thread or option in the docs ...

I set some columns to invisible initially and use ColVis to show them on demand. That is working fine. But the smart search/filter looks in all columns - visible and invisible ones.

How to setup datatables to search in visible columns only? (The optimum solution would be a checkbox to restrict the search to visibility.)

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Interesting one - the search and visibility are independent from each other - they can be made to match of course, which would initially give the effect you want, but that wouldn't work once the column visibility has changed. There currently isn't a way of dynamically changing the filtering columns in DataTables, but something could do added with a plug-in to do it and that could then be used to hook into ColVis. So it is possible, but would require a little bit of work to do.

    Allan
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    can you change bSearchable dynamically in the settings?
  • cyberlussicyberlussi Posts: 6Questions: 0Answers: 0
    I already thought of setting some classes dynamically when ColVis changes visiblity of columns and then reading those back to inhibit a search. But I could not find API for such things ...

    For sure this could be done in a plugin or with some fancy js tricks, but yes that is a little bit of work to do (which I cannot spent at the moment).
This discussion has been closed.