ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: omerix on December 28, 2024, 03:47:47 am
-
Hi,
I?m trying to use saveState to save everything in colModel along with the following additional properties and load them from localStorage on grid initialization:
numberCell.show
rowBorders
columnBorders
stripeRows
pageModel.type
sortModel.type
filterModel.type
For this purpose, I configured stateKeys as follows:
stateKeys: {
numberCell: ['show'],
rowBorders: 1,
columnBorders: 1,
stripeRows: 1,
groupModel: ['on', 'header'],
pageModel: ['type', 'rPP'],
sortModel: ['type', 'sorter'],
filterModel: ['type', 'header', 'menuIcon']
}
However, I couldn?t get these properties (like numberCell, pageModel.type, filterModel.type) to save with saveState or load correctly with loadState.
Am I missing something? How can I ensure these properties are properly saved and loaded?
Thanks in advance!
Jsfiddle: https://jsfiddle.net/pn92z1bt/3/
-
Your jsfiddle is not set up properly, so couldn't check it.
Please ensure you are using latest version of pqgrid and kindly share a jsfiddle using https://jsfiddle.net/xokyt062/ if facing any issues.
-
Hello Paramvir,
I updated the JSFiddle: https://jsfiddle.net/omerx/09qagv3z/ , but it doesn't work the same way as it does locally.
What I want to achieve: I would like to save all options (like those in the grid_parts demo) to localStorage using saveState and then reload them from there.
The idea is to create something like a merged version of the grid_parts demo and the grid_state demo.
grid_parts : https://paramquery.com/pro/demos/grid_parts (https://paramquery.com/pro/demos/grid_parts)
grid_state : https://paramquery.com/pro/demos/grid_state (https://paramquery.com/pro/demos/grid_state)
In addition to saving column layouts, I want to save and load other settings from localStorage. I would also like to include options for pageModel, sortModel, and filterModel. These options should allow users to toggle between local and remote settings, and the grid should restore them from localStorage when revisiting.
I've tried some implementations in JSFiddle but couldn't make it work. Any guidance would be greatly appreciated!
-
This example shows how to save and load state ( pageModel, filterModel, sortModel, colModel, etc ) from localStorage
https://paramquery.com/pro/demos/grid_state
You can test it by making some changes and reloading the page.