ParamQuery grid support forum

General Category => ParamQuery Pro Evaluation Support => Topic started by: j.jose on August 30, 2021, 07:00:59 pm

Title: Save state of the grid
Post by: j.jose on August 30, 2021, 07:00:59 pm
Hello Support Team,

Is there a functionality where the state of the grid is saved and can be reloaded later.

For instance, our use case is as follows:
User A has made some columns hidden in his grid by clicking on the 'menuIcon' and modified the order of the columns by drag-and-drop function.
When he opens the grid later, is it possible to reload the last grid state again ( for example: by loading the state as a JSON file in the cookies )?

Please advise if this function already exists and if there is an example to refer to.

If not, is there a possibility to have it in the future releases?

Thanking you in advance!

Best regards,
Jiny
Title: Re: Save state of the grid
Post by: paramvir on August 30, 2021, 09:39:28 pm
This functionality already exists. Please refer this example: https://paramquery.com/pro/demos/grid_state
Title: Re: Save state of the grid
Post by: j.jose on September 01, 2021, 05:15:36 pm
Hallo,

Thank you for the reply.
Could you please advise how the state can be saved without the buttons?
That is every time an event is triggered, the state of the grid should be saved.

Please inform me how this can be implemented.

Thanking you in advance!

Best regards,
Title: Re: Save state of the grid
Post by: paramvir on September 06, 2021, 06:56:41 pm
It's already mentioned in the demo:

Code: [Select]
        $(window).on('unload', function () {
            grid.saveState();
        });
        grid.on("destroy", function () {
            this.saveState();
        })