General Category > Help for ParamQuery Pro

Storing states in database

(1/1)

queensgambit9:
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.

paramvir:
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

Navigation

[0] Message Index

Go to full version