Column Ordering

State

Column ordering state is stored on the table using the following shape:

tsx
export type ColumnOrderTableState = {
columnOrder: ColumnOrderState
}
export type ColumnOrderState = string[]

Table Options

onColumnOrderChange

tsx
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.

Table API API

setColumnOrder

tsx
setColumnOrder: (updater: Updater<ColumnOrderState>) => void

Sets or updates the state.columnOrder state.

resetColumnOrder

tsx
resetColumnOrder: (defaultState?: boolean) => void

Resets the columnOrder state to initialState.columnOrder, or true can be passed to force a default blank state reset to [].