DataSource API
When rendering the
DataSource
component, you can get access to the API by getting it from the onReady
callback prop.<DataSource<DATA_TYPE> onReady={(api: DataSourceApi<DATA_TYPE>) => { // api is accessible here // you may want to store a reference to it in a ref or somewhere in your app state }}
COPY
You can also get it from the
InfiniteTable
onReady
callback prop:<InfiniteTable<DATA_TYPE> columns={[...]} onReady={( {api, dataSourceApi}: { api: InfiniteTableApi<DATA_TYPE>, dataSourceApi: DataSourceApi<DATAT_TYPE> }) => { // both api and dataSourceApi are accessible here }}
COPY
For API on row/group selection, see the Selection API page.
addData
(data: DATA_TYPE) => Promise
addDataArray
(data: DATA_TYPE[]) => Promise
clearAllData
() => Promise
getDataByNodePath
(nodePath: NodePath) => DATA_TYPE | null
getDataByNodePath
(nodePath: any[]) => DATA_TYPE | null
getDataByPrimaryKey
(primaryKey: string | number) => DATA_TYPE | null
getIndexByPrimaryKey
(id: any) => number
getOriginalDataArray
() => DATA_TYPE[]
getPrimaryKeyByIndex
(index: number) => any | undefined
getRowInfoArray
() => InfiniteTableRowInfo[]
getRowInfoByIndex
(index: number) => InfiniteTableRowInfo<DATA_TYPE> | null
getRowInfoByNodePath
(nodePath: any[]) => InfiniteTableRowInfo<DATA_TYPE> | null
getRowInfoByPrimaryKey
(id: any) => InfiniteTableRowInfo<DATA_TYPE> | null
insertData
(data: DATA_TYPE, { position, primaryKey }) => Promise
insertDataArray
(data: DATA_TYPE[], { position, primaryKey?, nodePath?, waitForNode? }) => Promise
isRowDisabled
(primaryKey: any) => boolean
isRowDisabledAt
(rowIndex: number) => boolean
onReady
(api: DataSourceApi) => void
removeData
(data: Partial<DATA_TYPE>) => Promise
removeDataArray
(data: Partial<DATA_TYPE>[]) => Promise
removeDataArrayByPrimaryKeys
(primaryKeys: (string | number)[]) => Promise
removeDataByNodePath
(nodePath: NodePath) => Promise
removeDataByPrimaryKey
(primaryKey: string | number) => Promise
replaceAllData
(data: DATA_TYPE[], options?: DataSourceCRUDParam) => Promise
setRowEnabled
(primaryKey: any, enabled: boolean) => void
setRowEnabledAt
(rowIndex: number, enabled: boolean) => void
treeApi
TreeApi<DATA_TYPE>
updateChildrenByNodePath
(children: DATA_TYPE[] | any | (children, data) => DATA_TYPE[] | any, nodePath: NodePath) => Promise, options?
updateData
(data: Partial<DATA_TYPE>, options?) => Promise
updateDataArray
(data: Partial<DATA_TYPE>[], options?) => Promise
updateDataArrayByNodePath
({data, nodePath}[]) => Promise
updateDataByNodePath
(data: Partial<DATA_TYPE>, nodePath: NodePath, options?) => Promise
waitForNodePath
(nodePath: NodePath, options?: { timeout?: number }) => Promise<boolean>