Select ListView items programmatically RRS feed

  • Question

  • How can I select items of my ListView in JS code? I have it's source binded to a WinJS.Binding.List.

    Please help

    Saturday, June 1, 2013 4:24 PM


  • Hi,

    Use the ListView.selection and in that use the set method. You can pass index array to it, items or keys. For more information on the SET method have a look at this link

    I did try that once and here is a sample code of setiing the index by passing array of index:

    var listview = document.body.querySelector(".myListview").winControl;
    var arraySelectedIndex = [2,4,6,7,10];

    Hope this helps..

    - Girija

    Please mark responses as answered if it helped you.. This helps others... - Girija Shankar Beuria

    • Marked as answer by Józef Karton Sunday, June 2, 2013 12:08 PM
    Sunday, June 2, 2013 12:30 AM