View as Markdown

API reference: @salmonui/data-grid

DataGridSaveEventinterface

import type { DataGridSaveEvent } from '@salmonui/data-grid';
interface DataGridSaveEvent<Row> extends DataGridEvent {
    readonly mode: EditMode;
    readonly added: readonly RowId[];
    readonly changed: readonly {
        readonly rowId: RowId;
        readonly fields: readonly string[];
    }[];
    readonly deleted: readonly RowId[];
    rows(): EditBatchChanges<Row>;
    readonly status: DataGridSaveStatus;
    readonly result: WriteResult<Row> | null;
    readonly error: Error | null;
    readonly failedRowIds: readonly RowId[];
}

onBeforeSave (before the write is sent; cancellable) / onSave (after the write settled). Lists are computed on first read.

DataGridSaveEvent members (13, 4 inherited)
NameSignatureDescription
modereadonly mode: EditMode;
addedreadonly added: readonly RowId[];
changedreadonly changed: readonly { readonly rowId: RowId; readonly fields: readonly string[]; }[];
deletedreadonly deleted: readonly RowId[];
rowsrows(): EditBatchChanges<Row>;

The rows with drafts applied (before-event); the rows written, with the source's echo where it sent one (after-event).

statusreadonly status: DataGridSaveStatus;

pending before the write; applied, partial (some rows failed), rejected, or error (the write threw) after.

resultreadonly result: WriteResult<Row> | null;

The data source's write result (after-event), else null.

errorreadonly error: Error | null;

The error a failed write threw (status error), else null.

failedRowIdsreadonly failedRowIds: readonly RowId[];

Rows the write did not apply (row or cell errors, conflicts, rejection); they keep their drafts.

typeinheritedtype: string;

'sortChange', 'beforeSortChange', ...

sourceinheritedsource: DataGridEventSource;
defaultPreventedinheriteddefaultPrevented: boolean;

True after preventDefault() (before-events and click events).

preventDefaultinheritedpreventDefault: () => void;

Before-events and click events: cancels the action (or the built-in behavior).