API reference: @salmonui/data-grid
DataGridEditorContextinterface
import type { DataGridEditorContext } from '@salmonui/data-grid';interface DataGridEditorContext<Row> {
readonly value: unknown;
setValue(value: unknown): void;
save(): void;
cancel(): void;
readonly row: Row;
readonly rowId: RowId;
readonly field: string;
readonly column: DataGridColumnInfo<Row>;
readonly errors: readonly string[];
readonly isNew: boolean;
readonly placement: 'cell' | 'dialog';
readonly editorProps: DataGridEditorProps;
readonly inputProps: DataGridEditorInputProps;
}
Context of column renderEditor.
| Name | Signature | Description |
|---|---|---|
value | readonly value: unknown; | The current draft value. |
setValue | setValue(value: unknown): void; | Sets the draft (the column parser converts strings; dates as ISO strings or |
save | save(): void; | Commits like Enter (row: the row; batch and cell: the cell). |
cancel | cancel(): void; | |
row | readonly row: Row; | The row with its drafts applied. |
rowId | readonly rowId: RowId; | |
field | readonly field: string; | |
column | readonly column: DataGridColumnInfo<Row>; | |
errors | readonly errors: readonly string[]; | |
isNew | readonly isNew: boolean; | |
placement | readonly placement: 'cell' | 'dialog'; | Where the editor renders. |
editorProps | readonly editorProps: DataGridEditorProps; | |
inputProps | readonly inputProps: DataGridEditorInputProps; | Spread onto the focusable element: id, aria-invalid / aria-describedby / aria-required, autofocus. The editing keys are handled by the editor wrapper. |