Looking for API for the filter value
Looking for API for the filter value
duselguy
Posts: 24Questions: 3Answers: 0
Hello,
For now I see only this way:
In search event handler to get settings.oPreviousSearch.sSearch .
But it is not recommended to use settings for read/write.
Any ideas?
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You want to get the column filter value? Use
column().search()
.Allan
No. The filter value from the search box to provide my own search.
My conf is:
You are using serverside, the search filter is passed in the URL / page request with each ajax call. Can you just pull it from there in your ajax page? Otherwise, you can look at the input value for the search boxes id which is {yourtableid}_filter.
Use
search()
if you want to get the global search value on the client-side.Allan
Hello,
Thank you for the comments.
I have no server - all data are processed locally. I'm using server-side and Scroller to process large tables (> 1000000 rows) with my own load, sort and search. For now, I'm using search event to provide my own search (although this event is schedulled too often :-). Using of my own handler for search box looks not good for me because DataTables already has good staff to process it. search() API is not suitable in my case. Should think about possibility to get/parse url to get the filter (instead of the search event processing). P.S. Really, my question was common: if settings should not be used directly, why there is no API to get settings' values to hide realization details and to protect from DT version to version changes. P.S.S. Thanks a lot for the great product and support.
But you have the
serverSide
option enabled in your above configuration. If you don't have server-side processing available, I'm not sure why that is enabled?A lot of the information needed externally is available via the API - for example the
search()
will given the current search term. There are other properties such as the sortable and filterable options which are no available via the API (although I plan to add them), but the majority of the internal properties are not useful externally and / or DataTables cannot cope with them being updated externally.Allan
serverSide:
I used http://datatables.net/extensions/scroller/examples/initialisation/server-side_processing.html as a sample.
Filter value:
I don't know how var x = settings.oPreviousSearch.sSearch in search event handler may be replaced by var x = table.search(input, ...) somewhere.
Just use
var x = table.search()
to get the current search term.Allan
Thank you,
I missed this, because search is in 2 forms in the reference. And I looked into the second :-(