Using setAt function in listview


  • I am not sure how to use the setAt funvtion in listview - should it be used on the listview object or the binding object? Here is my question

    DataExample.js file

    var dataArray = new Array(); var dataList = new WinJS.Binding.List(dataArray); // Create a namespace to make the data publicly // accessible. var publicMembers = { itemList: dataList, data_array: dataArray }; WinJS.Namespace.define("DataExample", publicMembers);

    I use the splice method to add values to the listview like this. It has 2 sub values - "data" and "noteindex"

     DataExample.itemList.splice(0, 0, { data: "Start noting", noteindex: DataExample.itemList.length });

    At some point I'd like to access the values stored in the list view and update them. I am not sure what to do here. I am using the below code but it is not working

    var newData = "Hello"
    var newnoteIndex = "2"
    DataExample.itemList.setAt[j].data.data = newData;
    DataExample.itemList.setAt[j].data.noteindex = newnoteIndex;
    How do I update the values written in the list?

    Tuesday, August 28, 2012 6:10 PM