Is it possible to dynamically disable sorting
Is it possible to dynamically disable sorting
I just discovered that our search engine, MeiliSearch, doesn't sort results in a way that fits with datatables.
https://github.com/meilisearch/meilisearch/issues/5180
While I understand their logic for prioritizing relevancy, I wish there were a way to make those results more configurable at runtime. Until then, is there a way to dynamically disable sorting when someone types into the search box? That way, we'd simply show the results sorted by relevancy.
That is, in this case, typing in the search would disable the up/down arrows on the sortable columns.
It's not an elegant solution, but it addresses the issue we saw with the scroller and search and sorting returning mixed up results.
I'm guessing listen for an event on the searchbox, the go through the tr / th and hide the arrows and events and add them back when the search box is empty? or maybe just show a warning message that results aren't really sorted as you'd expect.
This question has an accepted answers - jump to answer
Answers
No - I'm sorry there isn't. The best available would be to add a listener to the search box, and if something is typed into it, then use
order()
to set the ordering to an empty array (i.e. no ordering).Allan