How can I make the search bar not sync both ways when searching?
How can I make the search bar not sync both ways when searching?

I have two ways to search for things in my datatable - some dropdowns, and a search bar.
They work separately, but when I select a value in a dropdown, and use datatable.api().search(val).draw(), the search bar now ALSO contains the dropdown's selected value.
This effectively means that I can't use both the dropdowns and the search bar together, or that at least the usage would be confusing.
Long story short, I want to make it so that when I use the API search function, the search bar doesn't contain the term i just searched for.
This question has an accepted answers - jump to answer
Answers
Hi @Moghul ,
Yep, that's the behaviour for that search bar. If you don't want that, you could remove that element from the table (using
dom
), then insert your own input element (again, usingdom
) that performs the search but doesn't display it if search is executed through the API.Cheers,
Colin
Thanks for the answer. It would be nice if that was an option in the future.
I mean just being able to make it not update the search bar through some boolean or whatever.
The issue there is that
search()
and theinput
element use the same thing (i.e. theinput
actually usessearch()
under the hood). So not updating it would be confusing when you then go to change its value.Its sounds like you might want to implement a search plug-in.
Allan