# DataGridAddEvent (@salmonui/data-grid)

> The DataGridAddEvent interface of @salmonui/data-grid: onBeforeAdd / onAdd.

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

```ts
import type { DataGridAddEvent } 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 DataGridAddEvent<Row> extends DataGridEvent {
    readonly row: Readonly<Record<string, unknown>> | undefined;
    readonly position: 'top' | 'bottom';
    readonly rowId: RowId | null;
    readonly isNew: true;
    readonly _row?: Row;
}
```

`onBeforeAdd` / `onAdd`.

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `row` | `readonly row: Readonly<Record<string, unknown>> \| undefined;` |  | Initial values passed to `addRow` (by column id). |
| `position` | `readonly position: 'top' \| 'bottom';` |  |  |
| `rowId` | `readonly rowId: RowId \| null;` |  | Temporary id of the added row (after-event only). |
| `isNew` | `readonly isNew: true;` |  |  |
| `_row` | `readonly _row?: Row;` | optional | Type witness. |
| `type` | `type: string;` | inherited | `'sortChange'`, `'beforeSortChange'`, ... |
| `source` | `source: DataGridEventSource;` | inherited |  |
| `defaultPrevented` | `defaultPrevented: boolean;` | inherited | True after `preventDefault()` (before-events and click events). |
| `preventDefault` | `preventDefault: () => void;` | inherited | Before-events and click events: cancels the action (or the built-in behavior). |
