Don't Save the Search When bStateSave Is True And Has Filter Per Column
Don't Save the Search When bStateSave Is True And Has Filter Per Column
Hi, I have a problem with DataTables when I use bStateSave properties into true.
The sad news is bStateSave is save Searching/filtering, Sorting, Pagination and Length of record per page.
I have a Search per column.
And I don't want to save my search (general search and search per column).
I have tried to search on documentation but it didn't work.
This one is example: http://legacy.datatables.net/ref#fnStateSaveParams
On that documentation, we should put the code oData.oSearch.sSearch = "";
on fnStateSaveParams
.
I have tried it and it work for general search, but my search per column didn't work.
Any advise?
My code for search per column is:
$("#dataTable thead th input[type=text]").on('keyup change', function() {
otable.column($(this).parent().index() + ':visible').search(this.value).draw();
});
Answers
You can try my yadcf, among other of its features it does support stateSave for its filters. see sample page on the showcase
http://yadcf-showcase.appspot.com/DOM_source_select2.html
Sorry but I think you don't understand what my problem is.
I need the search data is unsaved on cookie.
So when the page is reloaded, the search won't appear again (when bStateSave is true)
In that case you can use the exResetAllFilters function, you can call it right after your dataTable initialization. It will reset all yadcf filters...