Share via


Shell.Data.DataSource.js

 

Applies To: Windows Azure Pack

The base class used to manage data queried either locally or from the server.

Widgets

None.

Types

Shell.Data.DataSource()

Enums

None

Properties

Name

Type

Description

Shell.Data.DataSource.dataSetName

String

Optional string that identifies the dataset that is the regularly refreshed cache that backs this data source.

Shell.Data.DataSource.filteredTotalCount

Object

An optional (possibly null-valued) count reflecting the total count of data items after filtering is applied (but no paging). This is useful to determine the number of pager buttons to be displayed in the user interface.

Shell.Data.DataSource.isQueryable

Boolean

true if this data source can process sort, paging and filtering queries. Otherwise false.

Shell.Data.DataSource.isReset

Boolean

true if the data source is in the 'reset' state. Otherwise false.

Shell.Data.DataSource.items

Object Array

Array of data items surfaced by this data source.

Shell.Data.DataSource.partialRefreshErrors

Object

If the last attempted refresh encountered partial errors, this property contains the errors returned along with data items. Otherwise, this property will be null-valued.

Shell.Data.DataSource.refreshError

Object

If the last attempted refresh encountered an error, this property contains the $.ajax failure arguments. Otherwise, this property will be null-valued.

Shell.Data.DataSource.refreshPromise

Object

If a refresh is in progress, this property contains the promise reflecting refresh progress.

Shell.Data.DataSource.totalCount

Object

An optional (possibly null-valued) count reflecting the total count of data items before paging and filtering is applied. This is useful to determine an absolute count of data items in the extension backend.

Methods

Name

Description

Returns

Parameters

Shell.Data.DataSource.dispose

Disposes of the data source.

Nothing

Disposes the data source.

Shell.Data.DataSource.refresh

Initiates an asynchronous request to populate the 'items' property with new data. Returns a promise. For more information, see Shell.Utilities.js.

Use this method to explicitly restart polling on the underlying data set, to reflect modified paging/sort/filter options, or to reapply the query to modified input data. The data source may recompute its 'items' synchronously, in which case the returned promise will already be resolved.

Promise

options (Object): An object containing options that vary between DataSource implementations.

Shell.Data.DataSource.reset

Empties the 'items' array of this data source and marks the data source as being in the 'reset' state.

Note

A data source leaves the reset state when the next refresh cycle successfully completes.

Nothing

None

Shell.Data.DataSource.setFilter

Modifies the filter directives used by this data source, which will be employed during the next refresh cycle. Returns the updated Data Source.

Shell.Data.DataSource

Filter: A function/object or array of functions/objects of the form function(item):boolean or { property: <propertyName>;, value: <propertyValue> [, operator: <operator> ] } or { operator: "||", value: [ <functionOrObject>, ... ] };

Shell.Data.DataSource.setPaging

Modifies the paging directives used by this data source, which will be employed during the next refresh cycle. When supplied as null/undefined, the current paging is cleared. Returns the updated Data Source.

Shell.Data.DataSource

paging (Object): An object of the form { skip: , take: }.

Shell.Data.DataSource.setSort

Modifies the sort directives used by this data source, which will be employed during the next refresh cycle. When supplied as null/undefined, the current sort is cleared. Returns the updated Data Source.

Shell.Data.DataSource

Sort: An function/object or array of functions/objects of the form function(item):number or { property: <propertyName>, descending: <boolean> }.

Remarks

This

See Also

Windows Azure Pack Extension Shell Library Reference