Loading state

Loading state

jklovancjklovanc Posts: 8Questions: 2Answers: 0

I am trying to figure out a way of creating multiple saved report formats that can be retrieved by different users in the future.

My idea is to use current data for the report, allow the admin to modify the report (hid columns, order report, search,etc), Then press a button to save the state in the database. Another user could then come along and select that report to run.

I can figure out how to get the current state using "state()" but I can't seem to be able to find how to load a state from a json.

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Unfortunately the load is effectively a missing method from the current API. It will be added in the next major version of DataTables, but until then you would need to call the various API methods to restore the state (page(), search(), etc). This could be wrapped up into a state load API method into which you could just pass an object.

    Regards,
    Allan

This discussion has been closed.