locked
DOMContentLoaded RRS feed

  • Question

  • I am trying to allocate an empty listview file, and then add events to it using xxxx.push functions.

    It works well in an example I have, but copy/move it, it is not working.

    The problem is that it is executing 'document.addEventListener("DOMContentLoaded", initialize'

    but it will not return to the code (as when it is working in the first case).

    Therefor the list is not initialized.

    (function () {
        "use strict";

        function initialize() {
            var astop1 = 0;
            WinJS.UI.processAll().done(function () {
                var astop2 = 0;
                // Get reference to ListView control
                var lvProducts = document.getElementById("lvProducts").winControl;

                // Create a List of products
                var listProducts = new WinJS.Binding.List([
     
                    { name: "Empty", text: "my text" }
                ]);

                // Bind the list of products to the ListView
                lvProducts.itemDataSource = listProducts.dataSource;
            });
        }
        document.addEventListener("DOMContentLoaded", initialize);
    })();

    Monday, July 8, 2013 5:42 AM

Answers

  • I just changed the call to ' <a href="simple\simtest\simtest.html">Simple Test ListView</a'

    and it is now working. The old call

    'comelist.onclick = function () { nav.navigate("/pages/homelist/homelist.html"); };'

    is not working. It did not call the initialize function.

    Now the problem is I need the 'back key' to get to the previous screen. How to combine the both features?

    • Marked as answer by my-ped01 Monday, July 15, 2013 6:19 AM
    Monday, July 8, 2013 7:21 AM