SearchBuilder stateRestore do not work when array type

SearchBuilder stateRestore do not work when array type

LapointeLapointe Posts: 430Questions: 81Answers: 4

stateSave :

stateRestore :

For other tests, sometimes the previous searchBuilder inclusion (like field = value) is not retored at all and the previous selected option in no more in the options list :smile:

stateSave :

stateRestore: (no filter restored)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    What is stateRestore here? That isn't a configuration option in DataTables / SearchBuilder.

    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Hi @allan
    Sorry... In fact stateRestore is (for me) the term to design here a stateLoadCallback call and apply stateSave stored datas...

                stateSave: true,
    
                stateSaveParams: function(settings, data) {
            //      data.selected = this.api().rows({selected:true})[0];
                },
                stateLoadParams: function(settings, data) {
            //      savedSelected = data.selected;
                    savedColumnsFilters = data.columns;
                },
                stateSaveCallback: function(settings,data) {
                    localStorage.setItem( 'recettes_".$UsrID."', JSON.stringify(data) );
                },
                stateLoadCallback: function(settings) {
                    return JSON.parse( localStorage.getItem( 'recettes_".$UsrID."' ) );
                },
    
  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @Lapointe ,

    I think this post is about the same issue?

    Try the possible solution I provided there.

    Otherwise can you please provide a test case so that I can see what is going wrong please?

    Thanks,
    Sandy

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    hi @sandy
    In fact when reopening table with stateSave active, for some case the settings seem to be ok (but filtering not) and some other case not (filtering parameters are not set or not fully set) as you can see in pictures at start of post.

    I'll try to set you an acces to software asap.

    ps what about the option list content separator as discussed in https://datatables.net/forums/discussion/comment/189787#Comment_189787

    Bob

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @Lapointe ,

    Thanks, if I can access the page then it should be a lot easier to debug.

    Thanks,
    Sandy

    ps You don't need to link to all of your open posts from each other. It's a lot easier if we just keep each post separate. This was they don't get clogged up unnecessarily.

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @Lapointe ,

    I think this issue should now be fixed. Take a look at this thread.

    Thanks,
    Sandy

This discussion has been closed.