Documentation

@kanunilabs/datagrid-react


@kanunilabs/datagrid-react / ColumnLookup

Interface: ColumnLookup<TRow>

Defined in: datagrid-core/dist/index.d.ts:465

A column whose stored value is a code and whose display is a label — categoryId: 3 shown and edited as "Hardware".

items may be a FUNCTION of the row, which is what makes a lookup cascade: the city list narrows to the country already chosen in the same row. The function receives the row with pending edits applied, so it cascades off what the user just typed rather than what the server last sent.

DISPLAY resolution only happens for the STATIC array form. Calling a user function once per rendered cell is on the hot path, and an async list cannot be resolved during a synchronous render at all — so a dynamic list is edit-time only, and a column that needs a label for it supplies a valueFormatter. debugMode says so rather than silently showing raw codes.

Type Parameters

TRow

TRow = GridRowData

Properties

allowCustom?

optional allowCustom?: boolean

Defined in: datagrid-core/dist/index.d.ts:474

Let the user type a value outside the list. Default false (closed list).


dependsOn?

optional dependsOn?: readonly string[]

Defined in: datagrid-core/dist/index.d.ts:472

Columns this list depends on. Purely declarative today — the list is re-derived every time the editor opens, so a cascade already works; this documents the relationship and lets a future build cache by dependency.


items

items: readonly LookupItem[] | ((row) => readonly LookupItem[] | Promise<readonly LookupItem[]>)

Defined in: datagrid-core/dist/index.d.ts:466


matchMode?

optional matchMode?: LookupMatchMode

Defined in: datagrid-core/dist/index.d.ts:483

How typed text narrows the list. Default 'startsWith'.

Prefix by default because a lookup list is usually a code list, and a code is read from the left — the user knows how it starts, not what it contains. 'contains' suits lists of prose labels, where the distinguishing word is rarely the first one.