Reputation: 1
I make a call to my jquery function after a client select and I find myself with this problem :
kendo.all.js:5282 Uncaught RangeError: Maximum call stack size exceeded
at Function (<anonymous>)
at o.filter (kendo.all.js:5282)
at kendo.all.js:5303
at U (kendo.all.js:4901)
at o.select (kendo.all.js:5243)
at o.group (kendo.all.js:5302)
at Function.o.process (kendo.all.js:5473)
at init._queryProcess (kendo.all.js:6877)
at init._process (kendo.all.js:6867)
at init._change (kendo.all.js:6834)
I found that in all the lines with the set () function I get this error, but when I change the function with a (=) and fetch of my grid the problem is terminated, I do not know c ' Is what the solution, I will assemble you a part of my code
function GetplanFormation1() {
var prj = $("#prj").val();
$.ajax({
type: 'GET',`
url: UrlRoot + 'Formation/readPlanFormation?client=' + cl + "&projet=" + prj,
success: function (data) {
for (var i = 0 ; i < data.length; i++) {
var dataItem = DSThemeFormation.get(data[i].id);
console.log("data", data);
if (data[i].PrjAct) {
dataItem.checked = true;
dataItem.nbj = data[i].j;
dataItem.id_org = data[i].org;
}
else {
dataItem.idP = data[i].idP;
}
}
},
error: function (xhr) {
if (prj == undefined) {
}
if (cl == undefined) {
}
}
});
}
Upvotes: 0
Views: 7322
Reputation: 4139
Using the set()
method of the dataItem will trigger the change
event of the Grid dataSource instance, which in turn will rebind the Grid. That's why, calling set()
a large number of times for granular data item updates is bad for the performance and causes the JavaScript error.
I recommend populating a standalone array of plain objects in the success
callback, and then assign the whole array as a new Grid dataSource via the dataSource's data()
method. In this way you will only have one change
event firing, and one Grid rebind.
Upvotes: 1