Hide Search UI but still use Search API in v2
Hide Search UI but still use Search API in v2
In v2, it appears that setting searching to false disables the search API. Any calls to the search API in this case succeed but nothing happens. In v2, how does one hide the search UI but still utilize the API?
Note that in v1, setting searching
to false did not disable the API. I have a custom search UI (nothing fancy, but it predates my using DataTables by many years), so I don't care to use the included UI. It calls the DataTables .search()
and column.search()
API, and worked great in v1.
Also, it would be helpful if the v1 vs v2 discrepancy in setting 'searching' were documented, perhaps both on the searching page and the Search API page? This change unfortunately caused me quite a lot of hours lost thinking a change in the .search()
API was the source of my troubles.
Answers
I'm so sorry... please disregard. Most of my post. I don't see a way to edit or delete it, or I would. Most of what I said turned out to be wrong due to a big mistake on my end. There was no v1 vs v2 API change here.
The original question of how to hide the UI while keeping search enabled remains, though. For now I'm handling it with CSS.
Again, so sorry for all the mess.
Hi,
I disabled the built-in search UI by using CSS (as well):
.dataTables_filter {
display: none;
}
Use the
layout
option to change the default element layout. SettopEnd: null
similar to the first example in the docs.Kevin
That's for DataTables 1.x. For 2.x use
div.dt-search
. Although, as Kevin says, I'd suggest usinglayout
to do this.Allan