Skip to content

@jsvision/datagrid / prefixWidth

Function: prefixWidth()

prefixWidth(p): number

Defined in: datagrid/src/synthetic-columns.ts:49

The total synthetic-prefix width in cells (0 when neither affordance is enabled). This is reserved to the left of the data columns, in the non-scrolling region.

Parameters

p

SyntheticPrefix

Which affordances are enabled and the row count.

Returns

number

The prefix width in cells.

Example

ts
import { prefixWidth } from '@jsvision/datagrid';
prefixWidth({ checkbox: true, rowNumbers: false, rowCount: 0 }); // 3  → "[x]"
prefixWidth({ checkbox: false, rowNumbers: true, rowCount: 100 }); // 4 → "100 "
prefixWidth({ checkbox: true, rowNumbers: true, rowCount: 9 }); // 3 + 2 = 5