StateSave not working for first visit of the page

StateSave not working for first visit of the page

chtcht Posts: 14Questions: 0Answers: 0

Hello,

I'm using Datatables 1.10.0 and Scroller 1.2.2dev with stateSave, serverSide and ajax. If you visit a page for the first time, the stateSave is not working. I already tried Datatables 1.10.1dev but the improvments there don't solve this problem. To see it, please follow the steps :

My testsystem is: http://tinyurl.com/l2ne36t Your login is: allan / 1234

Debug information: http://debug.datatables.net/epecoz

  • After login you will be taken to a page called "Mandators - selection". Click in the navigation area on "Bank protocols"
  • if you don't see any entries in the table put the filter dates from 7th july to 8th july and click "update"
  • the table should contain 6 entries and the default sort should be ascending over "Date/time"
  • click on "PTK file" in order to sort ascending over PTK files
  • click on one of the entries in the table to select a PTK-entry-
  • click "back"
  • the table is sorted ascending over "Date/time" and not over "PTK File"

All this happens only once. If you try it again, it works perfectly. To see it again, you have to delete your browser cache.

I hope, you can follow my description. If you need more information to analyze this, please let me know.

Cheers, Christian

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Hi Christian,

    Thanks for the clear description and the link. I've just tried it and it appears to work as expected for me in Chrome and Safari - the state information is retained. Is it a particular browser that you are using that is showing this error?

    Many thanks,
    Allan

  • chtcht Posts: 14Questions: 0Answers: 0

    Hi Allan,
    we made tests with IE10, chrome Version 35.0. and Firefox 30. In all of these browsers we can reproduce this thing when we visit the page for the first time. So you might have to empty your browser cache or delete your browser data (e.g. chrome://settings/...) before you try it again.
    It is important to know, that this error just occurs when you follow exactly the steps i wrote in my first post. if you switch the sort columns twice or if you select an entry before you sort, you won't see it.
    The table at the "Master data" page doesn't have this problem at all.
    Thanks and regards,
    Christian

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Hi Christian,

    I've just tried this on my Windows machine with IE, Firefox and Chrome and unfortunately wasn't able to reproduce the problem still.

    Having said that, I released DataTables 1.10.1 and Scroller 1.2.2 yesterday. I wonder if you might be able to update to these new versions to see if that helps to resolve the issue. I've done quite a lot of work on the state saving in DataTables since the development version you have, so hopefully it will "just work"!

    The updates are available on the download page.

    Regards,
    Allan

  • chtcht Posts: 14Questions: 0Answers: 0

    Hi Allan,

    thanks for the new releases! Unfortunately they don't solve this issue. As you haven't had the chance to reproduce this thing, i made some screenshots with explanations that i put in a word document. This document i will send you per email. I hope with these description you will be able to reproduce it.

    Regards,
    Christian

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Hi Christian,

    That would be great - thanks. I look forward to receiving your e-mail.

    Allan

  • chtcht Posts: 14Questions: 0Answers: 0

    Hi Allan,

    Thank you for your mail. Looks like you found something there. I will try that out soon and let you know if it helped.

    Regards,
    Christian

  • chtcht Posts: 14Questions: 0Answers: 0

    Hi Allan,
    you were right. These slight differences in the URLs we had caused the problem.

    Regards Christian

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Hi Christian,

    Great to hear that we were able to resolve this :-)

    Regards,
    Allan

  • GirishMahindrakarGirishMahindrakar Posts: 1Questions: 0Answers: 0

    HI Allan , Christian,

    Even we are facing the same issue. Will you please let us the know the fix you guys did.

    Regards,
    Girish

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    The problem was that the url of the second page wasn't the same as the first. So the state wasn't being reloaded, since DataTables uses a per-page state save by default.

    Allan

  • nick123nick123 Posts: 1Questions: 0Answers: 0

    Hi Allan, Thanks for your terrific work!

    Is there a nifty way to set some other identifier for the page ?
    Our URL's have variable content -- so the per-page state isn't working well for us.
    We would like to store the state information in the client local storage rather than implementing an AJAX callback and using the server -- but we can't make the URL's always the same.
    Ideas ?

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Use the stateSaveCallback and stateLoadCallback options to dump the data to be stored into a common localStorage key (and then read it back in future).

    Allan

This discussion has been closed.