0

我正在尝试使用 Json 做 ListView。但这显示错误,因为“WinJS.UI.ProcessAll() 未定义;”。我错过了什么吗?

//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();
})();
4

1 回答 1

1

尝试使用小写的 p。;) WinJS.UI.processAll()

http://msdn.microsoft.com/en-us/library/windows/apps/hh440975.aspx

于 2013-11-13T11:52:36.877 回答