Adaptable

#<Adaptable.DataSource /> props

Declares the data — and the data-loading behavior — for an Adaptable instance. It wraps the Adaptable.Provider:

<Adaptable.DataSource data={fetchFn} mode="server" batchSize={200}>
  <Adaptable.Provider adaptableId="app" primaryKey="id" defaultState={state}>
    <Adaptable.UI />
  </Adaptable.Provider>
</Adaptable.DataSource>

See Loading data for a guided tour.

6 props

#batchSizenumber

Server mode only: load each level in batches of this many rows - a batch is loaded when its rows scroll into view, and the data function gets batchStartIndex and batchSize.

Without it, each call returns a whole level: all the rows of a flat view, or the top-level groups, then all the children of a group when it is expanded. A pivot view without row groups has a single row, which is loaded in one call without batch params. Ignored in client mode.

#childrenRenderable

The subtree that consumes this data source — typically the Adaptable.Provider (with the Adaptable.UI inside).

#datarequiredAdaptableData<DATA_TYPE>

The data for the grid: an array of rows, a Promise resolving to rows, or a function.

The function form receives the current data params (sorting, filtering, grouping, pivoting, and the batch - batchStartIndex / batchSize) and returns — sync or async — either a rows array or a { data, totalCount } payload (totalCount is used in server mode).

#filterValuesFilterValuesFn

Loads the pickable values for single/multi value column filters ({ columnId, search, start, limit, cascadeFilter, ... } → values). Used for every column without its own filterValues; required in server mode for the pickers to show anything. Defaults to data.filterValues when the data function carries one.

#modeAdaptableDataSourceModedefault: 'client'

Who executes the data operations: 'client' (default - the grid, on every row) or 'server' (the server; the grid loads the rows of each level on demand, by calling the data function).

#refetchOnboolean | AdaptableDataRefetchValues[]default: false

Client mode only: the changes that call the data function again. It never changes who runs the operations - the grid still sorts, filters, groups and pivots the rows the function returns.

  • false (default): the function is only called initially.
  • an array of sort / filter / groupBy / pivotBy / viewChange: called again when any of those change (viewChange: the current view switches).
  • true: all of the above.

Not applicable in server mode, where every operation change and every view switch loads the data again.