WE plan to develop Admin screen that allows and saving to DB(MyViewSettings)
1. choose what columns they want to see on their report(ColumnVisibility checkbox in kendo grid)
2. specify filter criteria(FilterMenu in Kendo grid)
3. specify Group by columns(GroupByHeader in Kendo grid)
How do we save Kendo grid settings when user hits - Save View and load grid based on above settings when they view grid.
Can you provide suitable sample that demonstrates how we can achieve this?
8 Answers, 1 is accepted
Persisting current Grid setting is not supported out-of-the-box and it will require custom code. There are several ways to do that and which one you would choose depends entirely on you and on the exact setup that you have. For example you can use the grid and it's dataSource client-side API to get the current grid settings and save/load them from the dataBase. For convenience I created small jsBin example of saving current Grid settings to a cookie which you can use as a baseline to achieve the desired behavior.
the Telerik team
Since we have sensitive financial figures visible to only certain individuals, current setup is to use CSHTML approach(Hide that column from server side). We are using DataSourceRequest for server side sorting, paging and filtering.
Is there any way we put our own custom button "Save View", implement SaveViewAction in Controller, interrogate GridSettings on server side and Examining C# equivalent of Datasource to determine sort, filter, group and pagesize?
Basically you can include such custom command which to get current sort, filter, page and hidden columns settings using the grid and it's dataSource API and send them to the controller action where they will be saved to the DB. Then when the page with the grid is requested you can pass the settings to the View and apply them to the grid configuration before it's sent to the client side.
- Save settings (example for saving hidden columns):
- Accept the settings on the controller and save them to the DB:
- When the Grid page is requested get the settings from the DB and pass them to the View:
- Hide columns in the Grid based on the ViewModel:
the Telerik team
As I mention in my previous replies this functionality is not supported out-of-the-box and it will require custom solution, however I already provided such example which you can use as a baseline to achieve the desired behavior.
We have a demo that demonstrates using the local storage here:
Have a look and let me know in case you have further questions.