Is it not doable, or am I missing something?
6 Answers, 1 is accepted
The Kendo DataSource is meant to work with a set of data and not a single model. Perhaps you can use the good old $.ajax to retrieve your model. Something like this: http://jsfiddle.net/korchev/hDfDc/2/
Regards,
the Telerik team
// extend the viewModel with the response from the server
$.extend(viewModel, model);
I assume this then puts all the data coming back onto the root viewModel object right...
I guess the difference between Knockout and Kendo MVVM is knockout needs converting to .observable() where kendo you just need to give it the raw json and everything is automatically observable?
Here is the documentation for $.extend - it is part of jQuery actually. If you have nested objects in your model you need to change that line to:
$.extend(viewModel, kendo.observable(model));
Regards,
the Telerik team
Also can you comment on the other question? Kendo MVVM doesn't need to explicitly set observable, everything is always by default observable?
kendo.observable() makes everything observable by default. Of course $.extend does not know neither of Kendo nor of observable objects so you have to do this if you want to convert the model to observable before merging it with the root view model:
$.extend(viewModel, kendo.observable(model));
As for documentation - we don't have any documentation yet which shows how to use $.extend with an observable object. I guess the only gotcha is to use kendo.observable() for the second argument.
Atanas Korchev
the Telerik team
You should throw this in the new docs...I think (for me anyway) big selling feature over knockout to not have to make everything observable.