Skip to main content
Version: Next

TableOptions<D>

The empty definitions of below provides a base definition for the parts used by useTable, that can then be extended in the users code.

Example

export interface TableOptions<D extends object = {}}>
extends
UseExpandedOptions<D>,
UseFiltersOptions<D> {}
see https://gist.github.com/ggascoigne/646e14c9d54258e40588a13aabf0102d for more details

Extends

  • UseTableOptions<D>.UseExpandedOptions<D>.UseGlobalFiltersOptions<D>.UsePaginationOptions<D>.UseSortByOptions<D>

Extended by

Type Parameters

Type Parameter
D extends object

Properties

autoResetExpanded?

optional autoResetExpanded: boolean;

autoResetGlobalFilter?

optional autoResetGlobalFilter: boolean;

autoResetHiddenColumns?

optional autoResetHiddenColumns: boolean;

Inherited from

UseTableOptions.autoResetHiddenColumns


autoResetPage?

optional autoResetPage: boolean;

autoResetSortBy?

optional autoResetSortBy: boolean;

cellProps()?

optional cellProps: (cell) => TableCommonProps;

Function called for each table cell allowing style/className/role props to be overridden

Parameters

ParameterType
cellCell<D, any>

Returns

TableCommonProps


className?

optional className: string;

Optional method to pass style. Added to table element


columnProps()?

optional columnProps: (column) => TableCommonProps;

Function called for each table column allowing style/className/role props to be overridden

Parameters

ParameterType
columnColumn<D>

Returns

TableCommonProps


columns

columns: readonly Column<D>[];

Inherited from

UseTableOptions.columns


data

data: D[];

Inherited from

UseTableOptions.data


defaultCanSort?

optional defaultCanSort: boolean;

defaultColumn?

optional defaultColumn: Partial<Column<D>>;

Inherited from

UseTableOptions.defaultColumn


disabledMultiRemove?

optional disabledMultiRemove: boolean;

disableGlobalFilter?

optional disableGlobalFilter: boolean;

disableMultiSort?

optional disableMultiSort: boolean;

disableSortBy?

optional disableSortBy: boolean;

disableSortRemove?

optional disableSortRemove: boolean;

downloadEnabled?

optional downloadEnabled: boolean;

Enable toolbar with download option


downloadFilename?

optional downloadFilename: string;

downloadFormats?

optional downloadFormats: ("json" | "csv")[];

expandSubRows?

optional expandSubRows: boolean;

filterTypes?

optional filterTypes: FilterTypes<D>;

getRowId()?

optional getRowId: (originalRow, relativeIndex, parent?) => string;

Parameters

ParameterType
originalRowD
relativeIndexnumber
parent?Row<D>

Returns

string

Inherited from

UseTableOptions.getRowId


getSubRows()?

optional getSubRows: (originalRow, relativeIndex) => D[];

Parameters

ParameterType
originalRowD
relativeIndexnumber

Returns

D[]

Inherited from

UseTableOptions.getSubRows


globalFilter?

optional globalFilter: string | (rows, columnIds, filterValue) => Row<D>[];

headerProps()?

optional headerProps: (header) => TableCommonProps;

Function called for each table header allowing style/className/role props to be overridden

Parameters

ParameterType
headerHeaderGroup<D>

Returns

TableCommonProps


initialState?

optional initialState: Partial<TableState<D>>;

Inherited from

UseTableOptions.initialState


isMultiSortEvent()?

optional isMultiSortEvent: (e) => boolean;

Parameters

ParameterType
eMouseEvent<Element, MouseEvent>

Returns

boolean


manualExpandedKey?

optional manualExpandedKey: IdType<D>;

manualGlobalFilter?

optional manualGlobalFilter: boolean;

manualPagination?

optional manualPagination: boolean;

manualSortBy?

optional manualSortBy: boolean;

maxMultiSortColCount?

optional maxMultiSortColCount: number;

orderByFn()?

optional orderByFn: (rows, sortFns, directions) => Row<D>[];

Parameters

ParameterType
rowsRow<D>[]
sortFnsOrderByFn<D>[]
directionsboolean[]

Returns

Row<D>[]


pageCount?

optional pageCount: number;

paginateExpandedRows?

optional paginateExpandedRows: boolean;

rowProps()?

optional rowProps: (row) => TableCommonProps;

Function called for each table row allowing style/className/role props to be overridden

Parameters

ParameterType
rowRow<D>

Returns

TableCommonProps


sortTypes?

optional sortTypes: Record<string, SortByFn<D>>;

stateReducer()?

optional stateReducer: (newState, action, previousState, instance?) => TableState<D>;

Parameters

ParameterType
newStateTableState<D>
actionActionType
previousStateTableState<D>
instance?TableInstance<D>

Returns

TableState<D>

Inherited from

UseTableOptions.stateReducer


title?

optional title: ReactNode;

Toolbar title


useControlledState()?

optional useControlledState: (state, meta) => TableState<D>;

Parameters

ParameterType
stateTableState<D>
metaMetaBase<D>

Returns

TableState<D>

Inherited from

UseTableOptions.useControlledState