kendo mobile - Data-binding works first time only, in a detail view -
in this plunker sample, data-binding of detail view works on first show, not update when navigating other items.
what missing ? thanks!
html:
<body> <div data-role="view" data-model="aviewmodel" id="aview"> <div data-role="header"> <div data-role="navbar"> <span data-role="view-title">master</span> </div> </div> <ul data-role="listview" data-style="inset" data-bind="source: items, events : { click : onclickitem}" data-template="itemstemplate"> <script id="itemstemplate" type="text/html" > <a href="##">#:name#</a> </script> </ul> </div> <div data-role="view" id="adetailview" data-model="aviewmodel.currentitem" data-show="aviewmodel.ondetailviewshow"> <div data-role="header"> <div data-role="navbar"> <span data-role="view-title" data-bind="text:name"></span> <a data-align="left" data-role="backbutton">back</a> </div> </div> <ul data-role="listview" data-style="inset" > <li>name <span data-bind="text: name"></span></li> <li>value <span data-bind="text: value"></span></li> </ul> </div> <script src="script.js"></script>
js:
var app = new kendo.mobile.application(document.body ); viewmodel = function () { var self = this; function item (name, value) { this.name = name; this.value = value; } self.items = new kendo.data.datasource({ data: [ new item("aaa",1), new item("bbb",2), new item("ccc",3) ] }); self.currentitem = null; self.onclickitem = function(e) { e.preventdefault(); self.set("currentitem", e.dataitem); app.navigate("#adetailview", "slide"); } self.ondetailviewshow = function(e) { } self = kendo.observable(this); return self; }; var aviewmodel = new viewmodel();
Comments
Post a Comment