Hi,
I would like to validate this extension of kendo.data.DataSource:
Any thoughts or suggestions will be appreciated.
Thx,
Lucian
I would like to validate this extension of kendo.data.DataSource:
(function () {
if (kendo.data.DataSource.prototype.set == undefined) {
kendo.data.DataSource.prototype.set = function (id, model) {
var idx, length, data = this._flatData(this._data);
for (idx = 0, length = data.length; idx < length; idx++) {
// Found it?
if (data[idx].id == id) {
// Make sure it's model
if (!(model instanceof kendo.data.Model)) {
if (this.reader.model) {
model = new this.reader.model(model);
}
else {
model = new kendo.data.ObservableObject(model);
}
}
// Update it
data[idx] = model;
this._change();
break;
}
}
// Not found, add it
if (idx == length) {
this.add(model);
}
}
}
})();
Any thoughts or suggestions will be appreciated.
Thx,
Lucian