Skip to content

useTableRowIndex

@astryxdesign/core v0.7.1 · useTableRowIndex

The config is a MaybeRefOrGetter, so pass a getter or a ref to keep the plugin on the current values.

Parameters ​

NameTypeDefaultDescription
datareadonly T[]—The data array currently rendered by the table (post sort/filter/page). Numbering follows this order.
getRowKey(item: T) => string—Optional key extractor returning a unique string per row. When provided, index lookup is keyed by the returned string; otherwise items are matched by reference identity. A plain function in a getter is already stable, so there is nothing to memoize.
labelstring'#'Header label for the index column.
startFromnumber1First index value.

Returns ​

FieldTypeDescription
transformColumns(columns: TableColumn<T>[]) => TableColumn<T>[]Prepends the row-number column. Its key is __rowIndex, its width is pixel(48), it aligns to the end and it is not resizable. Group header rows get an empty cell. The number sits in a span.astryx-table__row-index, which is monospaced and right-aligned.