Savestate

Savestate

PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1

Hello Everyone,

I have a question about savestate, how long does it save your settings, like i set rows per page max to like 100, but i added options to change it to allow users to set more or less, but i notice it keeps going back to default after a while, so im wondering how long does it last?

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    It is up to you to set state duration.

    https://datatables.net/reference/option/stateDuration

  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1

    I just read a diff page, it said 2hrs is default, if I want it unlimited i need to do "stateDuration": 0
    correct?

  • allanallan Posts: 63,700Questions: 1Answers: 10,502 Site admin
    edited August 2015

    The documentation tangerine linked to states:

    This option is also used to indicate to DataTables if localStorage or sessionStorage should be used for storing the table's state. When set to -1 sessionStorage will be used, while for 0 or greater localStorage will be used.

    Could you clarify what is not clear about that and I'll fix it?

    Allan

  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1

    I realised now, that 0 means it don't clear, btw what's the difference between -1 and 0?

  • allanallan Posts: 63,700Questions: 1Answers: 10,502 Site admin
    • When set to -1 sessionStorage will be used

    Otherwise localStorage is used.

    Allan

  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1

    Thanks,
    Which one is the better one to use, currently im using 0

  • allanallan Posts: 63,700Questions: 1Answers: 10,502 Site admin

    Which do you want to use? Do you want it to be session based, or not? That's your answer :-)

This discussion has been closed.