Skip to content

@jsvision/datagrid / CellEditorSpec

Interface: CellEditorSpec

Defined in: datagrid/src/cell-editor.ts:81

The declarative editor descriptor a column carries. Only kind is required; the remaining fields apply to specific kinds — values to enum, items to lookup, create to custom, and validator to override a numeric kind's built-in keystroke filter.

Example

ts
import type { CellEditorSpec } from '@jsvision/datagrid';
const boolSpec: CellEditorSpec = { kind: 'boolean' };
const enumSpec: CellEditorSpec = { kind: 'enum', values: ['open', 'paid', 'shipped'] };
const lookupSpec: CellEditorSpec = { kind: 'lookup', items: [{ key: '7', label: 'Ada' }] };

Properties

create?

readonly optional create?: (field, host) => View | null

Defined in: datagrid/src/cell-editor.ts:91

The factory for kind: 'custom' — returns a View bound to field, honoring Enter=commit/Esc=cancel.

Parameters

field

Signal<string>

host

CellEditorHost

Returns

View | null


items?

readonly optional items?: LookupProvider

Defined in: datagrid/src/cell-editor.ts:89

The rows for kind: 'lookup' (a static array or an async provider).


kind

readonly kind: CellEditorKind

Defined in: datagrid/src/cell-editor.ts:83

Which typed editor the cell mounts.


validator?

readonly optional validator?: Validator

Defined in: datagrid/src/cell-editor.ts:85

Live keystroke filter (defaults per kind; overrides the built-in default when set).


values?

readonly optional values?: readonly string[]

Defined in: datagrid/src/cell-editor.ts:87

The value set for kind: 'enum' — rendered in order; selecting one commits that string.