Set column.searchable = true after DataTable initialisation
Set column.searchable = true after DataTable initialisation
guilhermemaranhao
Posts: 38Questions: 11Answers: 0
Hi everyone,
I've initialised my dataTable with the following setting:
columnDefs: [
{ targets: 1, type: 'diacritics-neutralise', searchable: true },
{ targets: '_all', searchable: false}
],
But depending on some user interactions in my application, I'd like to make column(0) searchable.
Is it possible?
Thank you,
Guilherme
This discussion has been closed.
Answers
Hi @guilhermemaranhao ,
Unfortunately not. Some properties (and behaviours) can only be set when the table is first initialised, and searchability is one of those.
What you could do perhaps, is when the user causes that interaction, is to reinitialise the table with the new
searchable
value. You could also pass indestroy
so all other properties would be the same. A side-effect would be searching, paging and ordering would be reset, but if it was important to maintain those, you could includestateSave
,Hope that helps,
Cheers,
Colin
Thanks, @colin ! I'll try it