need to $watch internal filterText & sLength variables
need to $watch internal filterText & sLength variables
ajoslin103
Posts: 20Questions: 4Answers: 0
in DataTables
I need to know when the user has changed the filter/search text and when they have changed the [page] length
How can I accomplish this?
Ideally I will use the Angular $watch function to do it
thanks
al;
This discussion has been closed.
Replies
DataTables triggers events to let you know when state has changed:
filter
page
Allan
I used search.dt & length.dt -- they work great
Question now is, how can I set the search text programatically ?
Use
filter()
andcolumn().filter()
.The full reference contains a list of all options, API methods and events.
Allan
sorry, to be more clear. I am using localBrowserStorage to return the table and associated controls to the state the user left them in. So by saving the values from the last of these events I can init the table with them next time. Except for the search term that the user typed into the search box. But I think I've got that one with plain old DOM-javascript. I just have to debounce the search term events as those come in after each key typed and I only want it from a second or so after they stop typing.
I have to handle returning the table to the proper page as well
This is a column filter control, or an external global filter control is it? Currently you need to use
settings()
and read the objectoLoadedState
to restore the state. I'm going to be reworking the state saving tomorrow and adding a new API method to get the saved state so you can restore your custom filters. The new method will be in 1.10.1.Allan