locked
Listview keeps on loading

    Question

  • Hi,

    I am having a very weird issue with the listview. I am updating the listview itemdatasource property in the ready function of the page. When the page loads, the listview shows a processing ring that goes on until and unless I click on the listview. The moment I click on listview, my data loads correctly. I am not sure whats happening here because I am doing the same thing on other page and it's working fine.

    Please guide me what is I am missing?

    Thanks

    Ravi


    • Edited by ravipiplani Sunday, October 07, 2012 1:15 PM
    Sunday, October 07, 2012 1:15 PM

Answers

  • Hi,

    I resolved the issue. We can't have the listview inside the form tag. If we keep it in form tag, listview will keep on loading unless you click on it.

    • Marked as answer by ravipiplani Friday, October 12, 2012 5:37 AM
    Friday, October 12, 2012 5:37 AM

All replies

  • Can you share some code?

    Zubair Ahmed | @zubairdotnet | zubairahmed.net | Win8RssReader.codeplex.com | facebook.com/zubair.ahmed.public

    Sunday, October 07, 2012 1:31 PM
  • Here is Javascript:

                        

    function loadLeftContainer() {
            var applicationData = Windows.Storage.ApplicationData.current;
            var localFolder = applicationData.localFolder;
            var oneListInfo;
            var listArray = [];

            localFolder.getFolderAsync("ListData").done(function (dataFolder) {
                dataFolder.getFilesAsync().done(function (files) {
                    var noOfFiles = files.length;
                    if (noOfFiles == 0) {
                        document.getElementById("listError").innerText = "There are no lists to display.";
                    }
                    else {
                        for (var i = 0; i < noOfFiles; i++) {
                            oneListInfo = {
                                listName: files[i].displayName,
                                creationDate: files[i].dateCreated.getDate() + " " + month[files[i].dateCreated.getMonth()] + ", " + files[i].dateCreated.getFullYear()
                            }
                            listArray.push(oneListInfo);
                        }
                        var dataList = new WinJS.Binding.List(listArray);
                        var taskL = document.getElementById("taskL").winControl;
                        taskL.itemDataSource = dataList.dataSource;


                        //WinJS.UI.ListView().forceLayout
                        if (appNameSpace.savedListIndex >= 0) {
                            taskL.selection.add(appNameSpace.savedListIndex);
                            loadListDataAfterSave(appNameSpace.savedListIndex);
                            document.getElementById("cmdSave").blur();
                        }
                        else {
                            document.getElementById("listError").innerText = "Tap on a list to display its contents.";
                            console.log(taskL.loadingState);
                        }
                    }
                });
            }, function error(e) {
            });
        }

    HTML:

    <div id="itemTemp" data-win-control="WinJS.Binding.Template">
            <div class="taskInfo">
                <h2 data-win-bind="innerText: taskName"></h2>
                <div class="taskInfo-detail">
                    <h4 data-win-bind="innerText: taskStatus" style="font-style: italic"></h4>
                </div>
            </div>
        </div>

    <div id="taskL" data-win-control="WinJS.UI.ListView" data-win-options="{itemTemplate: select('#displayListTemp'), oniteminvoked : listTappingHandler, layout: { type: WinJS.UI.ListLayout }}"></div>

    Sunday, October 07, 2012 2:13 PM
  • Hi,

    I resolved the issue. We can't have the listview inside the form tag. If we keep it in form tag, listview will keep on loading unless you click on it.

    • Marked as answer by ravipiplani Friday, October 12, 2012 5:37 AM
    Friday, October 12, 2012 5:37 AM