Perhaps I'm misunderstanding the concept of Kendo's MVVM implementation, but... I have a simple Kendo UI Mobile view
that is data-bound to a view model:
var myViewModel = kendo.observable({
myEntity: null,
onViewShow: function (e) {
var bindingEntity = myStaticDataSource[0];
myViewModel.set("myEntity", bindingEntity);
}
});
myStaticDataSource
is a static array of "entities" as simple JavaScript objects, with fields like name
or description
.
The view and its input fields are bound to the view model:
<div data-role="view" data-layout="default" data-model="myViewModel" data-bind="events: { show: onViewShow }">
<form>
<ul data-role="listview" data-style="inset">
<li>
<label>
Name
<input type="text" data-bind="value: myEntity.name" />
</label>
</li>
</ul>
</form>
</div>
When the user changes the input field, the corresponding field (e.g. name
) is updated in the data-bound view model entity myEntity
. But: what I would have expected is that the entity in myStaticDataSource
is updated as well, since I'm not cloning objects. But it isn't! Its value remains on the original value. Why is this? Am I missing something about Kendo's MVVM handling?