Searchbuilder - set criteria dynamically
Searchbuilder - set criteria dynamically
amacourek
Posts: 15Questions: 2Answers: 0
Can someone please point me to the documentation for setting the criteria dynamically? I have several criteria options for the user to choose and would like to change on the fly.
Answers
Are you wanting to do something like this example?
Kevin
Thanks for the reply, but I already have another implementation where I set the preDefined criteria on initialization. That is not the problem. I want to change the criteria post-initialization.
Maybe this example is what you are looking for.
Kevin
Again, thanks. However, this is not what I wanted. The latest example goes back to a snapshot. What I wanted was after a datatable/searchbuilder is initialized, call a method that passes a criteria definition and updates with what is provided. I guess I might just have to re-initialize the DT/SB each time.
The key thing that example shows is the use of
searchBuilder.rebuild()
. This is both a getter and setter. You can update the search criteria usingsearchBuilder.rebuild()
. I updated the example in the docs to include adding a criteria to the current search.https://live.datatables.net/talosuye/1/edit
Perform a search, Position = Developer for example. Then click the
Edinburgh
button to see the Office = Edinburgh criteria added to the current search criteria. The Get Details and Edinburgh buttons output the search criteria so you can see the data structure.Is this what you are looking for?
Kevin