Search code examples
javascriptlistviewmicrosoft-metrorefreshdatabound

How to modify cell content in (data bound) ListView.oniteminvoked event? [W8 Metro UI, WinJS]


I created a data bound listview in a Windows 8 HTML5/JavaScript app, I would like to modify the data bound to the clicked cell. For this I am using the ListView.oniteminvoked event.

The data is successfully modified, but the cell does not refresh.

The documentation says I should probably use "msSetImmediate", but I cannot understand how.

How to refresh the single cell? Could you provide me an example in which once clicked, the cell changes its content based on the modified data?


Solution

  • Problem (somehow) solved:

    eventObject.detail.itemPromise.done(function (invokedItem) {
        DataExample.data[invokedItem.index] = { newobject }
        dataList.setAt(invokedItem.index, { newobject });
    });
    

    Alas, setAt - although actually refreshes the cell contents - does not seem to modify the data array used to create the dataList, hence I am updating it manually before.