Deep Linking and stateSave
Deep Linking and stateSave
trongart
Posts: 222Questions: 51Answers: 0
Using deep linking as described here with stateSave does not seem to work as stateSave saves the search filter value. I tried to apply the following, but this does not help as it simply empties the search filter:
"stateSaveParams": function (settings, data) {
data.search.search = "";
}
How can I prevent stateSave from even accessing the search filter so it can work with search.search?
This question has accepted answers - jump to:
Answers
Instead of using
data.search.search = "";
, which will clear the search you might need to delete the search.search property. See if this works:Kevin
That works! Thank you!!
Is there also a way to prevent the searchBuilder conditions from being saved in stateSave? I tried the following under
stateSaveParams
, but this does not work:delete data.searchBuilder.getDetails();
I'm not sure of what exactly to delete, without setting it up to look at, but you can find out by using
console.log(data)
in theoption stateSaveParams
function. You will see all the data being saved.Kevin
Thank you! I can find both search and the searchBuilder under
console.log(data)
, but addingconsole.log(data.searchBuilder);
tostateSaveParams
produces undefined. How could I empty all searchBuilder criteria so none are saved withstateSave
?The SearchBuilder extension must add the
searchBuilder
property outside ofstateSaveParams
. So you won't have access to it there. UsestateLoadParams
instead, like this:http://live.datatables.net/nipebate/1/edit
Kevin
I would do the remove in the
stateLoadParams
, that's the only place where it's important,Colin
@kthorngren @colin This works in
stateLoadParams
. Thank you very much!