Wijmo UI for the Web
DataView Architecture
Wijmo User Guide > Data > Data Concepts > DataView Architecture

Advantages of Using Wijmo DataView

Simplifies datasource binding work, especially when the datasource is remote.

To bind the Wijmo DataView to a remote datasource, set the URL for the remote datasource and query options when you create the DataView object, then invoke the refresh function of the DataView.

RESTful service
Copy Code
var productView = new wijmo.data.AjaxDataView(
    "http://demo.componentone.com/aspnet/NorthwindAPI/api/read/Product",
    {
        pageSize: 10
    });
productView.refresh();

Unifies and simplifies query operations for different datasources.

Wijmo DataView unifies query operations for different datasources so that no matter what datasource you bind to it, you can invoke the filtersortpageSize, and pageIndex functions.

Filtering

To get an item with an id value of 1, write code like the following.

Filtering
Copy Code
data.filter({id: 1});

Sorting

To sort with the id field in descending order, and the name field in ascending order, write code like the following.

Sorting
Copy Code
data.sort(“id desc, name”);

Paging

To set up ten records per page and show the third page, write code like the following.

Paging
Copy Code
data.pageSize(10);
data.pageIndex(2);

Provides support for KnockoutJS.

Wijmo DataView provides a toObservableArray function that you can use to get an observable array for Knockout, and you can bind this array to the Knockout ViewModel.

Disadvantages of Not Using Wijmo DataView

If you get data without using Wijmo DataView, you need to do additional work.

For example, to get data from a RESTful service, you would need to:

  1. Get the XHR object via Ajax.
  2. Define the success, complete, and error callbacks for Ajax.
  3. Parse and store the results from the remote service in the client.
See Also

How To

Reference