The ability for a row to be pinned is determined by the following:
options.enableRowPinning
resolves to true
options.enablePinning
is not set to false
Pinning state is stored on the table using the following shape:
export type RowPinningPosition = false | 'top' | 'bottom'
export type RowPinningState = { top?: string[] bottom?: string[]}
export type RowPinningRowState = { rowPinning: RowPinningState}
enableRowPinning
enableRowPinning?: boolean | ((row: Row<TData>) => boolean)
Enables/disables row pinning for all rows in the table.
keepPinnedRows
keepPinnedRows?: boolean
When false
, pinned rows will not be visible if they are filtered or paginated out of the table. When true
, pinned rows will always be visible regardless of filtering or pagination. Defaults to true
.
onRowPinningChange
onRowPinningChange?: OnChangeFn<RowPinningState>
If provided, this function will be called with an updaterFn
when state.rowPinning
changes. This overrides the default internal state management, so you will also need to supply state.rowPinning
from your own managed state.
setRowPinning
setRowPinning: (updater: Updater<RowPinningState>) => void
Sets or updates the state.rowPinning
state.
resetRowPinning
resetRowPinning: (defaultState?: boolean) => void
Resets the rowPinning state to initialState.rowPinning
, or true
can be passed to force a default blank state reset to {}
.
getIsSomeRowsPinned
getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean
Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the top
or bottom
position.
getTopRows
getTopRows: () => Row<TData>[]
Returns all top pinned rows.
getBottomRows
getBottomRows: () => Row<TData>[]
Returns all bottom pinned rows.
getCenterRows
getCenterRows: () => Row<TData>[]
Returns all rows that are not pinned to the top or bottom.
pin
pin: (position: RowPinningPosition) => void
Pins a row to the 'top'
or 'bottom'
, or unpins the row to the center if false
is passed.
getCanPin
getCanPin: () => boolean
Returns whether or not the row can be pinned.
getIsPinned
getIsPinned: () => RowPinningPosition
Returns the pinned position of the row. ('top'
, 'bottom'
or false
)
getPinnedIndex
getPinnedIndex: () => number
Returns the numeric pinned index of the row within a pinned row group.
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.