Hey there, I have actually solved this with a short function that I think the entire Kendo library could use. It may need to be further refined, though.
kendo.data.ObservableObject.prototype.fromJSON = function (source) {
var name,
observable = this;
for (name in source) {
if (observable.hasOwnProperty(name)) {
observable.set(name, source[name]);
}
}
}
This will accept a javascript object, it does not yet check for functions or miscellaneous properties - but since it requires the destination to have the same properties that it moves over, it has yet to give me any trouble. It just iterates over the object and runs the Observable
'set' method on each top level item.
change: function (e) {
// get the selected row from the grid
var selected = this.select();
// get the data from the selected row
var data = this.dataItem(selected);
// update the model
viewModel.fromJSON(data.toJSON());
},
This gives you an updated model that is still ready for binding, without all of the extra code. It is also more inline with those who are accustomed to the KnockoutJS "mapping" plugin.