DataSource Props

In the API Reference below we’ll use DATA_TYPE to refer to the TypeScript type that represents the data the component is bound to.

aggregationReducers

Record<string, DataSourceAggregationReducer>

Specifies the functions to use for aggregating data. The object is a map where the keys are ids for aggregations and values are object of the shape described below.

data

DATA_TYPE[]|Promise<DATA_TYPE[]|() => DATA_TYPE[]|Promise<DATA_TYPE[]>

Specifies the data the component is bound to. Can be one of the following:

  • an array of the bound type - eg: Employee[]
  • a Promise tha resolves to an array like the above
  • a function that returns an any of the above

defaultSortInfo

DataSourceSingleSortInfo<T>|DataSourceSingleSortInfo<T>[]|null

Information for sorting the data. This is an uncontrolled prop.

lazyLoad

Default: false
boolean|{batchSize:number}

Whether the datasource will load data lazily - useful for server-side grouping and pivoting. If set to true or to an object (with batchSize property), the data prop must be a function that returns a promise.

groupBy

An array of objects with field properties, that control how rows are being grouped.

livePagination

boolean

Whether the component should use live pagination.

livePaginationCursor

string|number|((params) =>string|number)

A cursor value for live pagination. A good value for this is the id of the last item in the data array. It can also be defined as a function

onDataParamsChange

(dataParams: DataSourceDataParams<DATA_TYPE:>)=>void

A function to be called when data-related props/state change.

onLivePaginationCursorChange

(cursor)=> void

A function to be called when the livePaginationCursor changes.

sortInfo

DataSourceSingleSortInfo<T>|DataSourceSingleSortInfo<T>[]|null

Information for sorting the data. This is a controlled prop.

sortMode

'local'|'remote'

Specifies where the sorting should be done.

sortTypes

Record<string, ((a,b) => number)>

Describes the available sorting functions used for local sorting. The object you provide will be merged into the default sort types.