locked
Jquery- oniteminvoked not firing

    Question

  • I am writing a HTML/JavaScript Windows 8 application using jquery. I am able to grab a json object, return it and bind it to a WinJS.UI.Listview using jquery with no problem. I next would like to handle the selection (or clicking) of the item in the listview but cannot get it to fire no matter what I do. I read that I need to use the oniteminvoked event. Does anyone have any experience with getting this to work?

    var list = new WinJS.Binding.List(result);
                    var currentItems = new WinJS.Binding.List(list),listDiv = $('#item-view')[0];
    
                    var listView = new WinJS.UI.ListView(listDiv, {
                        itemDataSource: list.dataSource,
                        itemTemplate: ScoutTemplate,
                        oniteminvoked: selectionChanged ,
                        selectionMode: 'single',
                        tapBehavior: 'invokeOnly',
                        swipeBehavior: 'select',
                        layout: { type: WinJS.UI.GridLayout }
                    });

    This works and binds just fine.

            function selectionChanged(eventInfo) {
    
                var msgBox = new Windows.UI.Popups.MessageDialog("Worked");
    
                msgBox.showAsync();
    
            }

    The selectionChanged never gets fired at all. I have tried a million other things but it refuses to fire. Any ideas and thanks!

    Friday, December 26, 2014 3:29 AM

All replies

  • Please post a working project to OneDrive, share it here, and we'll check it out.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, December 26, 2014 2:06 PM
    Moderator