Using the Web Service Data Source

After you create and configure the remote web service, using the web service data source is straightforward. The following code illustrates how you can create an instance of the web service data source and bind it to a ListView control named lvTasks:

var lvTasks = document.getElementById("lvTasks").winControl;var tasksDataSource = new DataSources.WebServiceDataSource("http://localhost:51807/api/tasks", "id");lvTasks.itemDataSource = tasksDataSource;

When you create an instance of the web service data source, you must supply two arguments to the constructor: the URL of the web service and the name of the primary key property of the data to retrieve.

The URL http://localhost:51807/api/tasks ...

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.