List View Click Event Example Windows 8 JavaScript (WinJS)

Here is a simple example of selecting an item from a List View with Windows 8 JavaScript (WinJS).


Windows 8 Link List Click Event


 HTML ( nothing special here):

        <div id="basicListView"

JavaScript (this is inside my ‘ready’):

            /** Grabbing the List View by id **/
            var pictureListDOM = document.getElementById('basicListView').winControl;
            /** Add event listener **/
            pictureListDOM.addEventListener('iteminvoked', SelectItem);

            /** The Event **/
            function SelectItem(event) {
                var selectedItem = event.detail.itemIndex; // The index
                // Do what you need to do here

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Graveyard Database Logo

Has everything you want to know about grave yards. Plus has many celebrites and world leaders graves. Pssst it is my other site

Google + Profile
Check out Android Photo Mapping, its a app/site I been working on
Fabulou wholesale Petr Mrazek jersey is back. Best choice to get the wholesale Petr Mrazek jersey is suitable for all style of people.