Jsonを使用してListViewを実行しようとしています。しかし、これは「WinJS.UI.ProcessAll() is undefined;」というエラーを表示しています。何か見逃しましたか?
//default.html
<body>
<div data-win-control="WinJS.Binding.Template">
<h2 data-win-bind="textContent: title"></h2>
<img data-win-bind="src: imageUrl;alt: title" />
</div>
<div id="itemTemplateDiv" data-win-control="WinJS.UI.ListView" data-win-options="{
itemDataSource: Matlus.Data.itemsBindingList.dataSource,
itemTemplate: select('#itemtemplateDiv')
}"></div>
</body>
//default.js
(function(){
var app = WinJS.Application;
app.onactivated = function (args) {
downloadDataAsync().then(function (items){
assignToListView(items);
WinJS.UI.processAll();
});
};
function downloadDataAsync() {
return WinJS.xhr({ url: "http://matlusstorage.blob.core.windows.net/membervideos/AllMovies.json" }).then(function (xhr) {
var movies = JSON.parse(xhr.responseText);
//"[{\"Category\":\"Sci-Fi\",\"ImageUrl\":\"StarWarsEpisodeIV.jpg\",\"Title\":\"Star Wars Episode IV: A New Hope\",\"Year\":1977}
//({title: item.Title, imageUrl: "http://matlusstorage.blob.core.windows.net/membervideos/" + item.imageUrl, category: item.category, year:});
var items = [];
for (var i = 0; i < movies.length; i++) {
var item = movies[i];
items.push({ title: item.Title, imageUrl: "http://matlusstorage.blob.core.windows.net/membervideos/" + item.ImageUrl, category: item.Category, year: item.Year });
}
return items;
});
}
function assignToListView(items) {
Matlus.Data.itemsBindingList = new WinJS.Binding.List(items);
}
WinJS.Namespace.define("Matlus.Data", {
itemsBindingList: undefined,
});
app.start();
})();