Page Refresh Clears Selected with stateSave = true

Page Refresh Clears Selected with stateSave = true

ayzayz Posts: 63Questions: 23Answers: 1

When I refresh the browser page with my datatable, the selected items become unselected.

Is this the right behaviour or something definitely wrong with my code?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @ayz ,

    Yep, that's the expected behaviour. Some things can be preserved if stateSave is enabled, such as column ordering and filtering, but not the selection I'm afraid.

    Cheers,

    Colin

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    It would be possible to add the selection via the stateSaveParams option and stateLoadParams. Its possible that is something that Select should do out of the box - I've added it to the list.

    Thanks for the suggestion,
    Allan

  • ayzayz Posts: 63Questions: 23Answers: 1

    Slated for a release to come soon or...?

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    To come. I don't think it will be soon though I'm afraid - we've got a bit of a back log at the moment :).

    Allan

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited April 2018 Answer ✓

    Hi @ayz ,

    I just got that stateSave and Select working together. Take a look at this example here. Would this work for you?

    Cheers,

    Colin

  • ayzayz Posts: 63Questions: 23Answers: 1
    edited April 2018

    Wow, that's fantastic. Meaning I need to use a nightly build in production or something? And will work with any config of select e.g. 'multi' etc etc?

    Also if I'm using a 3rd party control, like kendoUI datepicker, would this automatically save the value which is obtained indirectly by calling .data("kendodatepicker").value() type notation?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited April 2018 Answer ✓

    Ah no, not dependent upon nightly, you can just shove your own library versions in there, that's just what the demos use by default. This will currently work with all row selections, whether single or multi, so that will be covered. The Selection extension also supports column and cell selection, it would be a trivial addition to support that if required.

    I'm not sure about datepicker - my demo just notes which rows have been selected, and adds that to the data that stateSave currently stores. If datapicker is needed somewhere, it'll be trivial to add that to saved information.

    Cheers,

    Colin

This discussion has been closed.