Implementing the change() Method

If you need to support editing items in a data source then you need to implement the change() method. Three arguments are passed to the change() method: the key of the item being edited, the new value of the item being edited, and the index of the item being edited.

Here’s some sample code for implementing the change() method:

change: function (key, data, indexHint) {    var index = this._getIndexFromKey(key);    this._arrayData[index] = data;    var newItem = {        key: key,        index: index,        data: data    };    return new WinJS.Promise.wrap(null);}

Notice that the change() method returns an empty promise. The method just completes without returning anything special. ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.