Hide Search UI but still use Search API in v2

Hide Search UI but still use Search API in v2

pbristowpbristow Posts: 2Questions: 1Answers: 0

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

  • pbristowpbristow Posts: 2Questions: 1Answers: 0

    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.

  • sgiesensgiesen Posts: 3Questions: 1Answers: 0

    Hi,

    I disabled the built-in search UI by using CSS (as well):

    .dataTables_filter {
    display: none;
    }

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    how to hide the UI while keeping search enabled remains

    Use the layout option to change the default element layout. Set topEnd: null similar to the first example in the docs.

    Kevin

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    .dataTables_filter

    That's for DataTables 1.x. For 2.x use div.dt-search. Although, as Kevin says, I'd suggest using layout to do this.

    Allan

Sign In or Register to comment.