This is a migrated thread and some comments may be shown as answers.

Saving custom settings of the grid

3 Answers 569 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrey
Top achievements
Rank 1
Andrey asked on 29 Apr 2016, 09:02 AM
Hello!
I know that user can save grid settings as per http://demos.telerik.com/kendo-ui/grid/persist-state
But it saves all settings. Is there a way to save a selected number of settings?
For example I want to save Sorting, Columns widths and Columns order.
Can this be done via some configuration? If no, can someone give an example how to implement it for localstorage?
Thanks!

3 Answers, 1 is accepted

Sort by
0
Andrey
Top achievements
Rank 1
answered on 30 Apr 2016, 07:29 PM
No one? Maybe Telerik support has something to say? We use the paid version of Kendo in our project if that matters.

Also I think there's a bug with `grid.getOptions()` because it save the data source! And if your data source is set dynamically and you get the new data and then click Load State it will load the data from the old source. That not what the user want, right? They just want their grid settings - ordering, sorting, widths etc.
0
Stephen
Top achievements
Rank 2
answered on 02 May 2016, 09:20 PM

You have to take what you want from getOptions() and discard what you don't want.  getOptions() literally returns all the current options of the grid that it uses to function internally...i.e. it is simply a public helper method to return what is essentially private data.

My post in http://www.telerik.com/forums/problem-with-saved-states explains what I do with it.

 

0
Boyan Dimitrov
Telerik team
answered on 03 May 2016, 07:49 AM

Hello Stephen,

 

Indeed in case of using local data binding the getOptions() method will return the data along with the data source settings. As Andrey suggested in this case the data should be removed from the JSON object returned by the getOptions() before passing to the setOptions().  

var options =grid.getOptions();
//it can be set to either null or emprty array []
options.dataSource.data = null;

 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Andrey
Top achievements
Rank 1
Answers by
Andrey
Top achievements
Rank 1
Stephen
Top achievements
Rank 2
Boyan Dimitrov
Telerik team
Share this question
or