Implementing the getCount() Method

The getCount() method should return the total number of records represented by the data source. For example, if you are storing items in a JavaScript array, then the getCount() method should return the length of the array:

getCount: function () {    return WinJS.Promise.wrap(this._arrayData.length);}

The getCount() method must return a promise. Therefore, you either need to wrap the return value in a promise using WinJS.Promise.wrap() or you need to create a new promise object.

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.