こんにちは、Icentium で最初のアプリをプログラミングしようとしています。知恵をjson配列に保存したい。レベルに応じて、新しい知恵を得ることができます。残念ながら、json 配列全体を表示している理由がわかりません。
これがlesses.jsです。
(function(global) {
var LessonsViewModel,
app = global.app = global.app || {};
LessonsViewModel = kendo.data.ObservableObject.extend({
lessonsDataSource: null,
init: function () {
var that = this,
dataSource;
kendo.data.ObservableObject.fn.init.apply(that, []);
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "data/lessons/lessons.json",
dataType: "json"
}
}
});
that.set("lessonsDataSource", dataSource);
}
});
app.lessonsService = {
viewModel: new LessonsViewModel()
};
これがビューです
<!--Lessons-->
<div id="tabstrip-lesson"
data-role="view"
data-title="Lektion"
data-model="app.lessonsService.viewModel">
<div class="lesson">
<div class="separator">
<div class="dark"></div>
<div class="light"></div>
</div>
<ul class="forecast-list"
data-role="listview"
data-bind="source: lessonsDataSource"
data-template="lessons-template"><!-- Das unten stehende Kendo Template wird hier eingefügt-->
</ul>
</div>
</div>
<!--Lessons Kendo Template für oben-->
<script type="text/x-kendo-tmpl" id="lessons-template">
<div>
<h1>${dojoroom}</h1>
<p>${text}</p><!-- Text aus Json File wird ausgelesen-->
</div>
</script>
これは私のjson配列です:
[
{
"dojoroom": "Dojo - First Room",
"text": "Bla bla bla!"
},
{
"dojoroom": "Dojo - Second Raum",
"text": "More Bla"
}
]