locked
ListView load stuck in infinite loop

    Question

  • I have an existing application that uses a listview and a custom adapter to a web service to load a tabular list of data.  When the application loads, we found that often the listview spins and spins and never seems to load data, as if it were timing out.  I added a timeout to the promise so that it wouldn't spin infinitely.  There's also a refresh button.  Once the initial promise timed out, if you click refresh, the list loads.

    I installed fiddler and found that the listview is actually receiving data upon the initial load, but it appears to reject it and makes the call to itemsFromIndex over and over again until the timeout fires, stopping the attempts to load.  Sometimes it asks for the same items repeatedly, other times the request index is different.

    I'm at a loss as to why the listview will not accept the data initially.  I've set a breakpoint and can see the data itself, it appears to be in the correct format:

    return {
           items: results, // The array of items with key and data. 
           offset: requestIndex - fetchIndex, // The index of the requested item in the items array.  
           totalCount: count                                 
    };

    I tried fiddling with the loading behavior and pages to load etc but that made no difference.

    listView.indexOfFirstVisible = AppGlobals.watchListIndex;
    listView.loadingBehavior = "incremental";            
    listView.pagesToLoad = 1;            
    listView.pagesToLoadThreshold = 1;            
    listView.automaticallyLoadPages = true;            
    listView.selectionMode = 'multi';            
    listView.tapBehavior = 'toggleSelect';            
    listView.groupHeaderTemplate = 
    element.querySelector(".headertemplate");            
    listView.itemTemplate = this.WatchListItemTemplate;          
    listView.oniteminvoked = this._itemInvoked.bind(this);      
    listView.onselectionchanged = MyApp.WatchList.AppBar.doSelectItem;

    At this point all I can think to do is to create a custom control that works like a listview, but where I have access to the logic inside so I can actually troubleshoot problems.

    Thursday, November 6, 2014 5:55 PM

All replies

  • Hi Peter,

    Can you send me a repro project to let me look into it. Use your OneDrive and share a link here.

    Thanks for understanding.

    Regards,


    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.

    Friday, November 7, 2014 1:36 PM
    Moderator