We use DataGrid version 2.5.1 and our users want to reorder columns, change sorting, etc. and want to keep those changes when returning to the app the next time.
Is there a best practice to notice (listener) any changes and save them so that these changes can be loaded the next time?
I did see some articles about saving configurations in datagrid web but i did not see anything for datagrid.Regards,
Rogier Mullaart
Hello,
This should be relatively straightforward to accomplish. You can use these blocks to listen for changes to the grid's configurations:
You can then use these client actions to get and set all of the grid's configurations at once (columns, filters, sorting, groups, etc.):
What I would to is to create a database entity to store each user's settings. This entity would need at least 2 attributes: the User ID and a text column with the JSON specifying the grid's settings (returned by the "GetViewLayout" client action).
Then, when the user logs in, you can fetch the settings from the database and store them in a client variable, so they're easily available when the user goes to the screen where they need to be used.
Hi Arelio,
This is what I was looking out and your solution helped me a lot.
Thanks,
Gowtham
Hi,
You can have a look at the available DataGrid API list. May be you can find something that serves your purpose.
GetColumsOrder is a client action which is not available in version 2.5.1. This answers my question indirect. We need to upgrade our DataGrid because a lot of actions are available in the latest version.
Regards,
Rogier.
Thank you for this guide! This is perfect and a good starting point.