Can I turn column option "searchable" on and off through the API?

Can I turn column option "searchable" on and off through the API?

morrtymorrty Posts: 29Questions: 6Answers: 0

I have several search fields that are each tied to a specific column and I use datatable.columns(4).search(search).draw(); to search in that specific column only. However I don't want the main filter search on the entire table to search these columns so I specify searchable = false on each of these columns. The problem is that the specific search boxes then no longer work.

As an alternative, can I restrict the main table's filter to certain columns without relying on column searchable?

Answers

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49

    Give this plugin a look over and see if it could solve your problem.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    I'm afraid the DataTables core API does not provide a way to change the columns.searchable option after initialisation. That is something I hope to add in future.

    As an alternative, can I restrict the main table's filter to certain columns without relying on column searchable?

    No. You would need to implement custom filtering to do that.

    Allan

This discussion has been closed.