View as Markdown

API reference: @salmonui/data-grid

DataGridRowDragEventinterface

import type { DataGridRowDragEvent } from '@salmonui/data-grid';
interface DataGridRowDragEvent<Row> extends DataGridEvent {
    readonly rowIds: readonly RowId[];
    rows(): readonly Row[];
    readonly fromIndex: number;
    readonly toIndex: number;
    readonly targetRowId: RowId | null;
    readonly position: 'before' | 'after' | 'into' | null;
    readonly parentId?: RowId | null;
    readonly valid: boolean;
    readonly reason: string | null;
    readonly targetGridId: string | null;
    readonly target: Element | null;
}

Row drag events (onRowDragStart, onRowDrag, onBeforeRowDrop, onRowDrop).

DataGridRowDragEvent members (15, 4 inherited)
NameSignatureDescription
rowIdsreadonly rowIds: readonly RowId[];
rowsrows(): readonly Row[];

The dragged rows (raw references).

fromIndexreadonly fromIndex: number;

Data row index of the first dragged row (-1 for rows from another grid).

toIndexreadonly toIndex: number;

Data row index the first row occupies after the drop; -1 without a valid target.

targetRowIdreadonly targetRowId: RowId | null;

Target row and side; null outside the grid rows.

positionreadonly position: 'before' | 'after' | 'into' | null;
parentIdoptionalreadonly parentId?: RowId | null;

Tree mode: the parent the rows join (into: the target row; null: the roots); undefined outside tree mode.

validreadonly valid: boolean;
reasonreadonly reason: string | null;

Why the target is invalid (self, sorted, groupChange, ...), or null.

targetGridIdreadonly targetGridId: string | null;

The grid the rows drop into: this grid's id, another grid's id, or null (custom target or nowhere).

targetreadonly target: Element | null;

Element under the pointer (pointer drags); null for keyboard and API moves.

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).