Invalid search options not to be restored

Invalid search options not to be restored

pgerundtpgerundt Posts: 90Questions: 13Answers: 2

Dear @colin & @sandy,

I cannot comment on the thread
https://datatables.net/forums/discussion/72231/invalid-searchpanes-options-should-not-be-restored-from-statesave#latest
anymore, so here's my answer.

Thank you very much for your fix, it works with storing in the HTML5 localStorage, but still behaves strangely when using stateSaveCallback. I will try to setup a test case as soon as possible.

First thing I noticed is that the searchPanes.selectionList doesn't seem to be included in the stateSaveParams as you can see here:

http://live.datatables.net/coduluva/5/edit
(just select a filter)

Answers

  • pgerundtpgerundt Posts: 90Questions: 13Answers: 2

    Hi guys,

    here is the final test case:
    http://live.datatables.net/coduluva/6/edit

    When selecting a random filter option and reloading the page, a JS error is thrown.

    Only chance to 'reset' this error: Disable stateLoadCallback and reload the page.

    There is no way to get rid of the invalid filter option.

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Many thanks - Sandy will take a look towards the end of the week when he is back.

    Allan

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @pgerundt ,

    SearchPanes uses the stateSaveParams event to add the SearchPanes data to the state object. This event listener is set after the one set in the datatables initialisation.

    I'd suggest that you set your listener after SearchPanes has initialised. You could set a listener inside the datatables initComplete option - at this point SearchPanes will have already set it's listener and yours should run after the options have been added.

    Thanks,
    Sandy

Sign In or Register to comment.