Links

Introduction

Executing a query directly against a data source returns a one-time result set. A DataSet is a class container that combines a query with a data source. It executes the query on behalf of consumers and stores the result set internally. It is then able to listen for changes that affect the query using Data Events. If the dataset picks up any changes, it will refresh the result set by re-running the updated query in the data service, update its internal result set, and alert consumers of the change.
This "live" connection to data services allows UI components to effectively talk to one another responding to user-interaction automatically without having to code them to explicitly handle events, refresh data, and re-bind their UI.

Configuration

A dataset constructor simply takes a data source and a query as a parameter.
const accountService = new wire.data.DataSource("custom", {
ServiceRoot: "./account"
});
const query = wire.data.select().from("Users")
.where().eq("fred", "x");
const dataset = new wire.data.DataSet({
Source: accountService,
Query: query
});
For more on datasets, visit the DataSet reference page.