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

Issue Saving/Loading grid options

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suzanne
Top achievements
Rank 1
Suzanne asked on 01 Nov 2018, 06:59 PM
Borrowing code from this page: https://demos.telerik.com/kendo-ui/grid/persist-state 
I added save/load buttons to my grid's toolbar.  I'm outputting the data in the console that gets saved and loaded, and they appear to match perfectly, however, when I load the data I've saved, the grid displays no data. 

Any idea what I'm doing wrong here?
function LoadPrefs() {
    var grid = $("#Inspections").data("kendoGrid");
    var options = localStorage["kendo-grid-options"];
    console.log(JSON.parse(options));
    if (options) {
        grid.setOptions(JSON.parse(options));
    }
}
function SavePrefs() {
    var grid = $("#Inspections").data("kendoGrid");
    var opts = grid.getOptions();
    console.log(opts);
    localStorage["kendo-grid-options"] = kendo.stringify(opts);
}

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 06 Nov 2018, 04:28 PM
Hello,

I have created a sample Kendo UI ASP.NET Core project using the provided click handlers of the buttons and placed them inside a toolbar template. Unfortunately, I was not able to replicate the problem, and the state is persisted as expected. Here is a short video demonstrating this functionality: 

https://www.screencast.com/t/7fD4nuby

Please, check out what are the crucial differences between the two projects. It will help me a lot to continue my investigation if you can modify the attached project to replicate the problem and send it back to us.


Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Suzanne
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or