fnStateSave fnStateLoad

fnStateSave fnStateLoad

atcs2152atcs2152 Posts: 12Questions: 0Answers: 0
edited September 2012 in General
I'm trying to use the fnStateLoad/fnStateSave callbacks to load/save the state from/to a server side database. I've seen the examples and added the code to my project but neither function ever seems to get triggered. I have bStateSave set to true (and it seems to work but via cookies instead of my database.) I've added a simply alert command within the fnStateSave function to see when it's triggered and to see what the data looks like but it never gets triggered. I'm not getting any JavaScript errors. A related questions is, how large does the database field need to be in order to save the state data?

Replies

  • atcs2152atcs2152 Posts: 12Questions: 0Answers: 0
    Perhaps this is related: I'm using fnReloadAjax to get the data rather than having it populated when the html page is first loaded. Is that the reason it never gets triggered?
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Can you run your table through the DataTables debugger so we can see what your functions are doing? Are they synchronous?

    > Perhaps this is related: I'm using fnReloadAjax to get the data rather than having it populated when the html page is first loaded. Is that the reason it never gets triggered?

    It should still get triggered, but I'm not sure what effect that would have on the reloading of the state - i.e. DataTables might try to restore paging to page 10, but if there is no data, then it can only show the first page.

    Allan
  • atcs2152atcs2152 Posts: 12Questions: 0Answers: 0
    Here it is, thanks. akeviw
  • atcs2152atcs2152 Posts: 12Questions: 0Answers: 0
    Well, I see that I needed a later version of DataTables. I now see that the function is getting called. Thanks.
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Ah great - good to hear :-)

    Allan
This discussion has been closed.