# DataGridEditorContext (@salmonui/data-grid)

> The DataGridEditorContext interface of @salmonui/data-grid: Context of column renderEditor.

Canonical: https://salmonui.dev/docs/reference/data-grid/DataGridEditorContext

```ts
import type { DataGridEditorContext } from '@salmonui/data-grid';
```

Entry index: https://salmonui.dev/docs/reference/data-grid (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/data-grid.md).

## Reference

Kind: interface

```ts
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`.

Members (13):

| Name | Signature | Flags | 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 `Date`). |
| `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. |
