Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

e(...).find(...).addBack is not a function Kendo Grid SetOptions

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:

object in console

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:

enter image description here

Any suggestions on how to resolve that error or how to get the desired behavior?

like image 443
Omar Martinez Avatar asked Dec 28 '25 13:12

Omar Martinez


1 Answers

The problem was the jQuery version, addBack function is added on the 1.8 version, this project still have the 1.7, just change the version and works perfect.

like image 171
Omar Martinez Avatar answered Dec 31 '25 03:12

Omar Martinez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!