bStateSave over different urls

bStateSave over different urls

lars16andelars16ande Posts: 5Questions: 0Answers: 0
edited January 2015 in Free community support

Hi,

I am using the bStateSave function. In version 10.4 it is now automatically using localStorage to store the state of the table. However I use some links in the table that create a popup to edit data for example. Behind the popup the table is still visible in the background, but because the link of the page has changed the state of the table changes back to the original state instead of the saved state that was in before clicking the edit-link.

In a previous version I had this script:

...
'bStateSave': true, 
'fnStateSave': function (oSettings, oData) {
    url = window.location.pathname;
  url = url.split(\"/-/\");
  url = url[0]
  if(url.substr(-1) == \"/\") {
    url = url.substr(0, url.length - 1);
  }
    localStorage.setItem( 'DataTables_'+url, JSON.stringify(oData) );
},
...

As you can see the script splits the url in two at "/-/" (the part before "/-/" always stays the same).
This way the script used to store the state of the table no matter what changed behind the "/-/" in the url.

Is there a way to achieve the same effect in v10.4 because I would really like to use some new features from this version.

Thanks in advance for any reactions.

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    The same should still apply using stateSaveCallback (it had to be renamed since the camelCase versions of bStateSave and fnStateSave would conflict!).

    Allan

This discussion has been closed.