Introducing StateRestore

Introducing StateRestore

sandysandy Posts: 913Questions: 0Answers: 234

I'm excited to announce the first release of our latest extension for DataTables: StateRestore.

Building on the stateSave initialisation option, StateRestore allows users to save multiple different states and restore them at any time, reverting the table back to how it was when the state was saved. You can also easily set which elements of DataTables are saved to a state on a state by state basis. There is a wide range of other options and examples showing what StateRestore can do.

StateRestore is available on our CDN via our download builder or direct file access, also on NPM / Yarn, NuGet, Composer and bower (see the download builder for details). The manual is available here including details on how to customise which elements of DataTables to save.

As always, we would welcome any feedback that you have! If you have any suggestions, please post them here. If you run into any issues, please let us know by creating a new thread with a test case, so we can keep track of individual issues.

Hopefully StateRestore can add some value to your projects!

Thanks,
Sandy

Replies

  • setwebmastersetwebmaster Posts: 77Questions: 5Answers: 0

    Hi there :smile:

    Nice work on this extension, I will try to replace StateSave with it in the following days.

    One question I would have would be if it is possible to use StateRestore without generating any button?
    I already have my UI elements that I use with StateSave and would like to simply swap the calls to the new api instead of StateSave if possible.

  • setwebmastersetwebmaster Posts: 77Questions: 5Answers: 0

    @sandy would you have an answer to the question above?

  • colincolin Posts: 14,172Questions: 1Answers: 2,401

    Sorry, we missed that message, but yep, as you can see in this example you can use the API to create and load states, and the buttons don't need to be present for that to happen.

    Colin

  • setwebmastersetwebmaster Posts: 77Questions: 5Answers: 0

    @colin Thanks for the reply. I had seen the example you linked to, but it is using both the api AND the buttons so that's why I was asking.

    When I tested it, there were errors trying to access the table.stateRestore.state($('#state-selector').<function> so I assumed it was because the buttons had not been initialized and there might be a problem in the overall StateRestore initialization process due to that.

    Is there any example of using the api only without initializing the StateRestore buttons? As all the references I found were initializing it via the "CreateState" button at the very least...

    Thanks in advance! :smile:

  • colincolin Posts: 14,172Questions: 1Answers: 2,401

    @setwebmaster Apologies for the late reply, I missed your question. There isn't an example currently, but I just created one (initialisation/noButtons) which will be on the site when StateRestore is next released.

    Colin

  • setwebmastersetwebmaster Posts: 77Questions: 5Answers: 0
    edited January 28

    @colin awesome, do we have a rough estimate of when that could be? (days, weeks, months?)

    *TBN: I have read the example directly from Gtihub and will try to implement it the same and see if there are differences that justify it didn't work on my case (maybe beacause I'm using Searchpanes, which is "incompatible" with StateRestore as of now if I remember correctly, but I didn't think it could be "breaking" StateRestore features ahah, I will have to test and report back :smile: )

    Thanks again and keep on with the great work that's being done on DataTables!

  • colincolin Posts: 14,172Questions: 1Answers: 2,401

    Ah yep, I was going to post a link to the github repo, but glad you found it. StateRestore doesn't sit well with SearchPanes, especially if you're using serverSide - so it could be down to that. I would suspect the next release would be in a week or two. We can take a look if you can post a test case.

    Colin

  • setwebmastersetwebmaster Posts: 77Questions: 5Answers: 0

    I'm not using SearchPanes with ServerSide option set, but I've been using Datatables for a couple years now and have customized it over time to better suit our needs so there might be some problems there.

    I will try to switch back to the "vanilla" distribution where possible and see if I can manage to make it work.

Sign In or Register to comment.