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-saveStatehttps://paramquery.com/pro/api#method-loadState