Search code examples
javascriptlistviewwinjs

WinJS listView ListLayout only selecting first row


I have my listview up and running. I can click on the first row and my changes occur then click again and then it changes back just the way I want. This works with single and multi select modes and any of the usable tapBehaviors. I can select different rows in directSelect and they will select but every time I click the changes only affect the first row. I am using a ListTemplate and an ItemInvokedHandler to get things working. Here is the invoked handler:

            var listview = document.querySelector('#myNote').winControl;

            listview.addEventListener("iteminvoked", itemInvokedHandler, false);

            function itemInvokedHandler(e) {

                e.detail.itemPromise.done(function (invokedItem) {

                    var whatItis = whatitis

                    if (whatItis === "whatItshouldNOTBe") {

                        var whatItshouldbe = (function () {
                            whatitis
                        })();


                    } else {

                        var whatItshouldNOTbe= (function () {
                            whatItShouldNOTBe

                        })();

                    }

                });
            };

Stepping through the program I find that the eventObject(e) does contain the data for all three rows that are selectable it is a matter of invoking these rows that I can not figure out.

Would appreciate any help. Thanks in advance.

-Rob0


Solution

  • Found my answer:

    WinJS.Binding.as(document.querySelector(".win-selected").style.height = "70px");
    

    I was not getting the exact (or being precise enough) element with my querySelector. Checking the DOM as it changed help me see this.

    I realize that my original code up above is probably to sparse to really be of any help.

    --------UpDate---------- As a note:

    When using:

    WinJS.Binding.as(document.querySelector(".win-selected").style.height = "70px");
    

    to be more precise use the ID of the element that you want to affect like this:

    WinJS.Binding.as(document.querySelector(".win-selected #yourElementID").style.height = "70px");
    

    -Rob0