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.

batchOperationDelay

number

The delay in milliseconds to wait before mutations are applied. This is useful to batch multiple mutations together.

data

DATA_TYPE[]|Promise<DATA_TYPE[]|(params:DataSourceDataParams) => DATA_TYPE[]|Promise<DATA_TYPE[]>

Specifies the data the component is bound to.

defaultFilterValue

{field?, id?, filter: {type, operator, value}[]

Uncontrolled prop used for filtering. Can be used for both client-side and server-side filtering.

defaultRowDisabledState

{enabledRows,disabledRows}

The uncontrolled prop for managing row enabled/disabled state. For the controlled version see rowDisabledState. For listening to row disabled state changes, see onRowDisabledStateChange.

defaultRowSelection

string|number|null|object

Describes the selected row(s) in the DataSource

defaultSortInfo

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

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

defaultTreeExpandState

TreeExpandStateValue

Specifies the expand/collapse state of the tree nodes. See TreeExpandStateValue for the shape of this object. For the controlled version, see treeExpandState.

defaultTreeSelection

TreeSelectionValue

Determines what nodes are selected and deselected. For the controlled version see treeSelection.

filterDelay

Default: 200
number

The delay in milliseconds before the filter is applied. This is useful when you want to wait for the user to finish typing before applying the filter.

filterFunction

({ data, dataArray, index, primaryKey }) => boolean

A function to be used for client-side filtering.

filterModedeprecated

'local'|'remote'

Explicitly configures where filtering will take place. Update to use the shouldReloadData.filterValue prop.

filterTypes

Record<string,{operators,emptyValues, defaultOperator}>

Specifies the available types of filters for the columns.

filterTypes.components.FilterEditor

A custom React component to be used as an editor for the current filter type

filterValue

{field?, id?, filter: {type, operator, value}[]

Controlled prop used for filtering. Can be used for both client-side and server-side filtering.

groupBy

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

groupBy.column

Partial<InfiniteTableColumn<T>>

An object that configures how the column for the current group should look like

isNodeCollapsed

(rowInfo: InfiniteTable_Tree_RowInfoParentNode<DATA_TYPE>, treeExpandState: TreeExpandState) => boolean

Decides if the current (non-leaf) node is collapsed. See related treeExpandState prop.

isNodeExpanded

(rowInfo: InfiniteTable_Tree_RowInfoParentNode<DATA_TYPE>, treeExpandState: TreeExpandState) => boolean

Decides if the current (non-leaf) node is expanded.

isNodeReadOnly

(rowInfo: InfiniteTable_Tree_RowInfoParentNode<DATA_TYPE>) => boolean

Decides if the current (non-leaf) node can be expanded or collapsed and if the tree icon is disabled.

isRowDisabled

(rowInfo: InfiniteTableRowInfo<T>) => boolean

This function ultimately decides the disabled state of a row. It overrides both defaultRowDisabledState/rowDisabledState props.

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.

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

nodesKey

string

The name of the property in the data object that contains the child nodes for each tree node.

onCellSelectionChange

(cellSelection, selectionMode='multi-cell') => void

A function to be called when the cellSelection changes.

onDataMutations

({ mutations, dataArray, primaryKeyField }) => void

Callback prop to be called when the data changes via the DataSource API.

onDataParamsChange

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

A function to be called when data-related state changes.

onFilterValueChange

({field?, id?, filter: {type, operator, value}[]) => void

Callback prop called when the filterValue changes.

onLivePaginationCursorChange

(cursor)=> void

A function to be called when the livePaginationCursor changes.

onNodeCollapse

(nodePath: NodePath, {dataSourceApi}) => void

Called when a node is collapsed. See related onNodeExpand and onTreeExpandStateChange props.

onNodeExpand

(nodePath: NodePath, {dataSourceApi}) => void

Called when a node is expanded. See related onNodeCollapse and onTreeExpandStateChange props.

onReady

(dataSourceApi: DataSourceApi<DATA_TYPE>) => void

The callback that is called when the DataSource is ready. The dataSourceApi is passed as the first argument.

onRowDisabledStateChange

(rowDisabledState) => void

Called when the row disabled state changes.

onRowSelectionChange

(rowSelection, selectionMode='single-row'|'multi-row') => void

A function to be called when the rowSelection changes.

onSortInfoChange

(sortInfo | null) => void

Called when sorting changes on the DataSource.

onTreeExpandStateChange

(treeExpandState: TreeExpandStateValue, {dataSourceApi,nodePath, nodeState}) => void

Called when the tree expand state changes.

onTreeSelectionChange

(treeSelection: TreeSelectionValue, context) => void

Called when the tree selection changes. See treeSelection.

pivotBy

DataSourcePivotBy<DATA_TYPE>[]

An array of objects with field properties that control how pivoting works. Pivoting is very often associated with aggregations, so see related aggregationReducers for more details.

primaryKey

string | (data: DATA_TYPE) => string

The name of the id/primary key property of an item in the data array. The value of this property needs to be unique.

refetchKey

string|number|object

A value that can be used to trigger a re-fetch of the data.

rowDisabledState

{enabledRows,disabledRows}

Manages row enabled/disabled state. For the uncontrolled version see defaultRowDisabledState. For listening to row disabled state changes, see onRowDisabledStateChange.

rowSelection

string|number|null|object

Describes the selected row(s) in the DataSource

selectionMode

'single-row'|'multi-row'|'multi-cell'|false

Specifies the type of selection that should be enabled.

shouldReloadData

{ sortInfo, groupBy, filterValue, pivotBy }

Specifies which changes in the data-related props should trigger a reload of the data source - applicable when data is a function.

shouldReloadData.filterValue

boolean

Explicitly configures where filtering will take place and if changes in the filterValue should trigger a reload of the data source - applicable when data is a function. Replaces the deprecated filterMode

shouldReloadData.sortInfo

boolean

Specifies if changes in the sortInfo should trigger a reload of the data source - applicable when data is a function. Replaces the deprecated sortMode.

sortFunction

(sortInfo:DataSourceSingleSortInfo<T>[], arr: T[]) => T[]

Custom sorting function to replace the multisort function used by default.

sortInfo

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

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

sortModedeprecated

'local'|'remote'

Specifies where the sorting should be done. Use shouldReloadData.sortInfo instead.

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.

treeExpandState

TreeExpandStateValue

Specifies the expand/collapse state of the tree nodes. See TreeExpandStateValue for the shape of this object. For the uncontrolled version, see defaultTreeExpandState.

treeSelection

TreeSelectionValue

Determines what nodes are selected and deselected. For the uncontrolled version see defaultTreeSelection.

useGroupKeysForMultiRowSelection

Default: false
boolean

Specifies whether rowSelection contains group keys or only row ids/primary keys.