jQuery UI Widgets Forums General Discussions Wishes for savestate and loadstate

This topic contains 2 replies, has 2 voices, and was last updated by  antonomase 9 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Wishes for savestate and loadstate #49813



    Three wishes for savestate, loadstate, autosavestate and autoloadstate for jqxGrid

    1) Declare where to save the state : localStorage or sessionStorage
    2) Give a name to the saved state
    3) Add a method removestate

    For point 1, it’s because user who returns 3 days later is surprised to see the filters and sorts are still applied
    For point 2, it’s because i manage a list of people, a list of companies, a list of customers, … and i work with copy/paste of my source code.All my grids in different pages have the same name and so the savestate name in the storage is allways jqxGridmygridname
    For point 3, it’s just to delete a saved state without knowing the name used by jqxGrid

    Best regards,

    Wishes for savestate and loadstate #49814

    Peter Stoev

    Hi antonomase,

    You can use the “savestate” and “loadstate” methods to manage all of these items. You get the state when you wish in your code by using “savestate” and you load it through “loadstate” when you wish, too.

    Best Regards,
    Peter Stoev

    jQWidgets Team

    Wishes for savestate and loadstate #49818


    Hi Peter,

    I use savestate to get the state of a grid. My wishes are on the life time of the saved state (permanent or just for the session), the name of the saved state and a method to delete a saved state.

    For the moment, i write this

    function writestate () {
     var state = $("#jqxgrid").jqxGrid('savestate');
     sessionStorage.setItem ("jqxmyname", JSON.stringify(state));
    function loadstate () {
    var state = sessionStorage.getItem("jqxmyname");
     if (state) {
      $("#jqxgrid").jqxGrid('loadstate', JSON.parse(state));

    the functions are handled on events on the grid (savestate) and on ready (loadstate).

    it will be easier to have something like that

    $("#jqxgrid").jqxGrid('savestate', 'session', 'jqxmyname');
     $("#jqxgrid").jqxGrid('loadstate', 'session', 'jqxmyname');
     $("#jqxgrid").jqxGrid('removestate', 'session', 'jqxmyname');

    and samething with autosavestate and autoloadstate

      autosavestate : true,
      autoloadstate : true,
      autosavestatestorage: 'session|local',
      autosavestatename: 'the_name_of_the_state'

    But it’s just an idea…

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.