locked
set ListView currentItem from JS

    Question

  • Hi All...

    I am setting the datasource for Listview in js file since I am fetching the data from a service and if I set the datasource in HTML, it throws exception. It works fine and now my requirement is to set third item as current item(selected item) of a listview.I am setting the index in ready event

    var listView = element.querySelector(".xxxx").winControl;            
    listView.itemDataSource = source.dataSource;
    listView.currentItem.index = 5;
    listView.currentItem.hasFocus = true;
    listView.currentItem.showFocus = true;

    but it always highlights the listview first item instead of specified index item.

    Note: I tried setting the index in loadingstatechanged event .but it remains the same.

    Let me know how to modify the selecteditem of a listview dynamically.

    Thanks in advance....


    Nazia

    Monday, October 28, 2013 8:03 AM

All replies