ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on May 13, 2025, 01:16:55 pm

Title: Storing states in database
Post by: queensgambit9 on May 13, 2025, 01:16:55 pm
Hi

I am currently using states (localstorage). Is there a tutorial or example on how to instead store in database along with user data. Using MySQL/PHP.

Thanks in advance.
Title: Re: Storing states in database
Post by: paramvir on May 13, 2025, 08:05:26 pm
There is no demo for saving it in db as the process also involves user authentication to tie / associate the state with the user.

If you have user authentication already in place, then the process is quite simple:

first receive the state as string with saveState method and pass save: false to the method so as to avoid saving it to localStorage.

post the state string to remote url along with user token id and save it in a single field corresponding to the user in a table.

Get the state corresponding to the user whenever required and use loadState method to restore the state of the grid.

https://paramquery.com/pro/api#method-saveState

https://paramquery.com/pro/api#method-loadState