Documentation

@kanunilabs/datagrid-react


@kanunilabs/datagrid-react / LookupLabels

Class: LookupLabels<TRow>

Type Parameters

TRow

TRow = GridRowData

Constructors

Constructor

new LookupLabels<TRow>(controller): LookupLabels<TRow>

Parameters

controller

DataGridController<TRow>

Returns

LookupLabels<TRow>

Properties

effectiveRow

effectiveRow: ((rowKey) => unknown) | null = null

The row WITH pending edits (batch mode keeps them out of the data), so a child list follows a parent the user changed but has not saved. Set by the grid on every render.

Methods

items()

items(lookup, row, rowKey, fresh?): readonly LookupItem[] | Promise<readonly LookupItem[]>

The list for this row: an array when known, the promise while it is not. Called through the cache — the same row and dependsOn values never call items twice — except with fresh (a list without dependsOn, opened in the editor: it may read anything, so it is asked again, as before).

Parameters

lookup

ColumnLookup<TRow>

row

TRow

rowKey

RowKey

fresh?

boolean = false

Returns

readonly LookupItem[] | Promise<readonly LookupItem[]>


label()

label(def, columnId, value, storedRow, rowKey): string | typeof LOOKUP_PENDING | null

A FUNCTION lookup's label for a cell: the label, LOOKUP_PENDING while the list is in flight, or null when the column is not a function lookup or the value is not in the list (the caller falls through to the value).

Parameters

def

GridColumnDef<TRow> | undefined

columnId

string

value

unknown

storedRow

TRow

rowKey

RowKey

Returns

string | typeof LOOKUP_PENDING | null