how to unapply any states just for current page from code

how to unapply any states just for current page from code

crcucbcrcucb Posts: 97Questions: 33Answers: 0

I have an address page that utilizes saved states & state restores with a button that opens a google map with whataver addresses are being shown. Each map icon contains a link to edit the address which opens page to edit (which is the same source page but opens the second page in a new tab) , I pass the addressaid so it knows what is being edited.

In this second page, I want to remove any saved states & serches but I don't want to affect the original page and states applied if & when I refresh.
I currently have this in datatable configuration:
stateLoadParams: function(settings, data) {
if (pAddressAID !==0 ) {
data.search.search = '';
return false;
}; //if (pAddressAID !==0 ) {
},

pAddressAID is the addressID that is being edited passed from the map.

this seems to work but when I refresh my original page, the state is no longer selected and I have to reselect.

I would like to remove current searcheds & searchbuilder in the second page and have it not affect the first address page.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 65,249Questions: 1Answers: 10,814 Site admin
    Answer ✓

    I think what you could do is simply:

    stateSave: pAddressAID === 0
    

    in your initialisation. That will enable state saving if pAddressAID is 0, and disable it otherwise.

    Allan

  • crcucbcrcucb Posts: 97Questions: 33Answers: 0

    Brillant!

Sign In or Register to comment.