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.
-
Author
-
Hi,
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 removestateFor 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 jqxGridBest regards,
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 StoevjQWidgets Team
http://www.jqwidgets.comHi 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'); localStorage.removeItem("jqxGridjqxgrid"); 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…
-
AuthorPosts
You must be logged in to reply to this topic.