Вопрос

I am starting to develop a cross platform app using Kendo UI and Icenium to which I am totally new , I am trying to get this example to work in a new project to,inorder to get used to data-binding and MVVM in this new environment , so I started a new kendo ui mobile app which has multiple views and a big collection of functionalities . what am I trying to do is to get this simple example to run inside icenium .. (Javascript)

var viewModel = kendo.observable({
name: "John Doe",
displayGreeting: function() {
    var name = this.get("name");
    alert("Hello, " + name + "!!!");
}
});
kendo.bind($("#view"), viewModel);

HTML

<div id="view" data-role="view">
<input data-bind="value: name" />
<button data-bind="click: displayGreeting">Display Greeting</button>
</div>

the example runs perfect on jsfiddle.net ,

I don't get the structure of the app and the data that exists at app.js and where should I initialize the view model .

Это было полезно?

Решение

If you are creating a mobile application, you don't need to call kendo.bind..., you just need to create the kendo.mobile.Application, and then define which model your view will be bound to by adding data-model="viewModel".

var app = new kendo.mobile.Application(document.body, { platform: 'ios' });

<div id="view" data-role="view" data-model="viewModel">...</div>

http://jsbin.com/UGoSute/1/edit

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top