I am using kendoui library to build a mobile application. I am having a problem in listing the data in listview. I am binding my listview to the observable itemViewModel But it seems it is not binding well, it seems its a silly error in the code. This is the code.
javascript
var itemViewModel = new kendo.observable({
item: {
name: " a name",
price: 30
},
itemDataSource: new kendo.data.DataSource({
data: [{
name: "cover",
price: 20
}, {
name: "charger",
price: 20
}, {
name: "bag",
price: 30
}]
})
});
var app = new kendo.mobile.Application(document.body);
Html
<div data-role="view" data-title="Views" id="item-list-view" data-layout="mobile-layout" data-bind="itemViewModel" >
<ul data-role="listview" data-style="inset" data-type="group">
<li id="itemslist">For Sale
<ul
data-role="listview"
data-style="inset"
data-type="group"
data-template="item-list-template"
data-bind="source:itemDataSource">
</ul>
</li>
</ul>
</div>
<script type="text/x-kendo-template" id="item-list-template">
<li><a href="\#item-form-view">#= name # <span class="sales-hold">→ $ #= price #</span></a></li>
</script>
This is a link to the code.
If the code is fine.
My question : Is it enough to just instantiate the kendo.mobile.application in order to bind the view to the modelView or I want to do anything else?
Please I need some help.
The problem was the data-bind="itemViewModel" it should be data-model="itemViewModel" .
<div data-role="view" data-title="Views" id="item-list-view" data-layout="mobile-layout" data-model="itemViewModel" >
........
....the rest of my code
........
</div>