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).
| Name | Signature | Description |
|---|---|---|
rowIds | readonly rowIds: readonly RowId[]; | |
rows | rows(): readonly Row[]; | The dragged rows (raw references). |
fromIndex | readonly fromIndex: number; | Data row index of the first dragged row (-1 for rows from another grid). |
toIndex | readonly toIndex: number; | Data row index the first row occupies after the drop; -1 without a valid target. |
targetRowId | readonly targetRowId: RowId | null; | Target row and side; null outside the grid rows. |
position | readonly position: 'before' | 'after' | 'into' | null; | |
parentIdoptional | readonly parentId?: RowId | null; | Tree mode: the parent the rows join ( |
valid | readonly valid: boolean; | |
reason | readonly reason: string | null; | Why the target is invalid ( |
targetGridId | readonly targetGridId: string | null; | The grid the rows drop into: this grid's id, another grid's id, or null (custom target or nowhere). |
target | readonly target: Element | null; | Element under the pointer (pointer drags); null for keyboard and API moves. |
typeinherited | type: string; |
|
sourceinherited | source: DataGridEventSource; | |
defaultPreventedinherited | defaultPrevented: boolean; | True after |
preventDefaultinherited | preventDefault: () => void; | Before-events and click events: cancels the action (or the built-in behavior). |