@dojo/dgrid/providers
September 13, 2017 ยท View on GitHub
A lightweight API is provided to use any underlying data format or store with dgrid.
Because dgrid takes a reactive, uni-directional approach, data providers may update state or interpret state without interference. The entirety of the grid's state is driven by the object created by the data provider.
Features
- An abstract base class to extend from
- Sort functionality
Implementation
Extend DataProviderBase and implement buildData. Data providers should always leave intact the first generic, which allows consumers to indicate the structure of data that will be used.
buildData has access to two instance properties:
options: Used to configure the data source and unique to each data provider, indicated throughDataProviderBase's second generic, passed to the constructorstate: Contains how data should be processedstate.sort: An array ofSortDetailsobjects containing thecolumnIdanddirection
Data Structure
The object created by buildData must return a DataProperties instance which contains:
sort: An array ofSortDetailsobjects containing thecolumnIdanddirectionthat should match the current stateitems: An array ofItemPropertiesobjects with anidof type string and thedatavalue containing the underlying data object