locked
WinJS ListView stops processAll().done from firing

    Question

  • I have a list view that that stops  WinJS.UI.processAll().done() from being fired.
    While debugging I found the error was that cannot read datasouce of null, as you can see below it is in fact null, so I can fix this by changing to data: {dataSource:null} now the page process , but now I cant assign data as I did before. See below top.
    I am new to WinJS and a bit confused
    Thanks

       ListViewData.listView.data = itemList;
            }
            else {
    
                ListViewData.listView.update(itemList);
    WinJS.Namespace.define("ListViewData.listView", {
        data: {dataSouce: null},
        update: function (list) {
            var k = this.data.length;
            for (var i = 0; i < k; i++) {
                this.data.pop();
            }
            k = list.length
            var listViewData = this.data
            list.forEach(function (item) {
                listViewData.push(item);
            });
        },
    });


        <div id="listView"
             class="win-selectionstylefilled"
             data-win-control="WinJS.UI.ListView"
             data-win-options="{
                itemDataSource: ListViewData.listView.data.datasource,
                itemTemplate: select('.smallListIconTextTemplate'),
                itemsReorderable: true,
             selectionMode:'single',
             layout: { type: WinJS.UI.ListLayout } }">
        </div>


    Alan Mosley - ThatsIT Solutions

    Wednesday, April 15, 2015 3:47 AM

Answers

  • by changing

    data: null;

    to

    data: new WinJS.Binding.List([]),
    stopes the errors but now my list view shows raw JSON rather then my template.

    Any ideas thanks


    Alan Mosley - ThatsIT Solutions

    • Marked as answer by Alan Mosley Wednesday, April 15, 2015 9:31 AM
    Wednesday, April 15, 2015 4:49 AM
  • I solved raw Jason problem by moving template above listview.

    Thanks


    Alan Mosley - ThatsIT Solutions

    • Marked as answer by Alan Mosley Wednesday, April 15, 2015 9:31 AM
    Wednesday, April 15, 2015 9:31 AM

All replies

  • by changing

    data: null;

    to

    data: new WinJS.Binding.List([]),
    stopes the errors but now my list view shows raw JSON rather then my template.

    Any ideas thanks


    Alan Mosley - ThatsIT Solutions

    • Marked as answer by Alan Mosley Wednesday, April 15, 2015 9:31 AM
    Wednesday, April 15, 2015 4:49 AM
  • I solved raw Jason problem by moving template above listview.

    Thanks


    Alan Mosley - ThatsIT Solutions

    • Marked as answer by Alan Mosley Wednesday, April 15, 2015 9:31 AM
    Wednesday, April 15, 2015 9:31 AM
  • Thanks for sharing the solution :)

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 21, 2015 1:23 PM
    Moderator