I have a Grid with a button that take you to other view where all the data of the item selected is show, what I'm trying to do is that when the user return to the grid view, the filters of the grid remain instead of show all the data.
For saving the filters, I use the getOptions
method of Kendo Grid and stored on localStorage
using the following code:
var grid = $("#Grid").data("kendoGrid");
var op = grid.getOptions();
localStorage["KendoGridOptions"] = JSON.stringify(op);
And get this:
The problem is when I try to use the setOptions
method, I do this on $(document).ready
after initialize the grid:
var options = localStorage["KendoGridOptions"];
if (options) {
var op = JSON.parse(options);
var grid = $("#Grid").data("kendoGrid");
grid.setOptions({
dataSource: op.dataSource
});
localStorage.removeItem("KendoGridOptions");
}
And I get this error on the gid.setOptions
line:
Any suggestions on how to resolve that error or how to get the desired behavior?