Column ordering state is stored on the table using the following shape:
export type ColumnOrderTableState = { columnOrder: ColumnOrderState}
export type ColumnOrderState = string[]
onColumnOrderChange
onColumnOrderChange?: OnChangeFn<ColumnOrderState>
If provided, this function will be called with an updaterFn
when state.columnOrder
changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.
setColumnOrder
setColumnOrder: (updater: Updater<ColumnOrderState>) => void
Sets or updates the state.columnOrder
state.
resetColumnOrder
resetColumnOrder: (defaultState?: boolean) => void
Resets the columnOrder state to initialState.columnOrder
, or true
can be passed to force a default blank state reset to []
.
getIndex
getIndex: (position?: ColumnPinningPosition) => number
Returns the index of the column in the order of the visible columns. Optionally pass a position
parameter to get the index of the column in a sub-section of the table.
getIsFirstColumn
getIsFirstColumn: (position?: ColumnPinningPosition) => boolean
Returns true
if the column is the first column in the order of the visible columns. Optionally pass a position
parameter to check if the column is the first in a sub-section of the table.
getIsLastColumn
getIsLastColumn: (position?: ColumnPinningPosition) => boolean
Returns true
if the column is the last column in the order of the visible columns. Optionally pass a position
parameter to check if the column is the last in a sub-section of the table.
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.