I am using the setOptions method of the Kendo UI Grid to persist user options for columns, sorting, etc. I am storing the options in local storage of the browser.
I need to call setOptions when the view is displayed and the Grid has been created. It's a bit inconsistent, as sometimes when the grid.setOptions() is called, the grid object is undefined. How can I make sure that I don't call grid.setOptions until the grid is ready to use? Code snippet shown below.
$("#grid").kendoGrid({
});
var grid = $(_gridId).data("kendoGrid");
var options = localStorage['xxxx'];
if (options) {
grid.setOptions(JSON.parse(options));
}