I am working on a project where some of our views(older) are not using kendo-knockout.js but the file is included in our shared layout. I am loving the kendo-konckout library, but found that it interfered with the natural way that kendo's grid works when using the built in add Commands on the grid. When removing the scripts those views worked, but obviously our views that use kendo-knockout didn't.
I debugged a bit and found that I get a value of null result in the piece of code below. I changed it to check for null and it sorted out my problem. result might come back with null./undefined in some cases which will cause errors. I reckon it could be a good plan to check for that and handle it in some gracious way?
Null/undefined error found on line 298 of script
(function () {
var existing = kendo.data.ObservableArray.fn.wrap;
kendo.data.ObservableArray.fn.wrap = function (object) {
var result = existing.apply(this, arguments);
result._raw = function () {
return object;
}
return result;
};
})();
I replaced the above code with this and it sorted out my problem...
//attach the raw data after Kendo wraps our items
(function () {
var existing = kendo.data.ObservableArray.fn.wrap;
kendo.data.ObservableArray.fn.wrap = function (object) {
var result = existing.apply(this, arguments);
if (result != undefined) {
result._raw = function () {
return object;
};
}
return result;
};
})();
Hi,
I am working on a project where some of our views(older) are not using kendo-knockout.js but the file is included in our shared layout. I am loving the kendo-konckout library, but found that it interfered with the natural way that kendo's grid works when using the built in add Commands on the grid. When removing the scripts those views worked, but obviously our views that use kendo-knockout didn't.
I debugged a bit and found that I get a value of null result in the piece of code below. I changed it to check for null and it sorted out my problem. result might come back with null./undefined in some cases which will cause errors. I reckon it could be a good plan to check for that and handle it in some gracious way?
Null/undefined error found on line 298 of script
(function () { var existing = kendo.data.ObservableArray.fn.wrap; kendo.data.ObservableArray.fn.wrap = function (object) { var result = existing.apply(this, arguments); result._raw = function () { return object; } return result; }; })();
I replaced the above code with this and it sorted out my problem... //attach the raw data after Kendo wraps our items (function () { var existing = kendo.data.ObservableArray.fn.wrap; kendo.data.ObservableArray.fn.wrap = function (object) { var result = existing.apply(this, arguments); if (result != undefined) { result._raw = function () { return object; }; } return result; }; })();
chrs Hennie