Class GeRowDragEvent<T>

A row drag (EventListenerIf.onRowDragStart, EventListenerIf.onRowDragMove, EventListenerIf.onRowDragEnd).

Call preventDefault to veto: in "start" no drag happens, in "move" the target is invalid (no drop marker, no drop). In managed mode "end" comes after the move (moved, toIndex = the real position).

Example

const listener = new EventAdapter();
listener.onRowDragEnd = (evt: GeRowDragEvent<Order>) => {
if (evt.moved) {
const ids = evt.rows.map(order => order.id);
void fetch("/api/orders/move", { method: "POST", body: JSON.stringify({ ids, toIndex: evt.toIndex }) });
}
};

Since

1.1.95

Type Parameters

  • T = any

Hierarchy

  • GeRowDragEvent

Constructors

  • Type Parameters

    • T = any

    Parameters

    • type: GeRowDragEventType

      Phase of the drag.

    • source: GeRowDragSource

      Pointer or keyboard.

    • rows: T[]

      The dragged row objects (tree: the TreeRows) in display order.

    • rowIndices: number[]

      Display indices of the dragged rows when the drag started (ascending).

    • target: undefined | RowDropTargetIf

      The current drop target – undefined if there is none (invalid, vetoed, outside the table).

    • toIndex: number

      Flat tables: display index of the first dragged row after the drop (0 = first row), -1 without target. Trees: -1 before the move; in a managed "end" the index the row really got.

    • outside: boolean

      true if the pointer is outside the table – e.g. over an own drop zone of the page.

    • managed: boolean

      true if the table moves the rows itself (RowDragOptionsIf.managed).

    • Optional originalEvent: PointerEvent | KeyboardEvent

      The browser event behind this event (pointer or keyboard).

    Returns GeRowDragEvent<T>

Properties

managed: boolean

true if the table moves the rows itself (RowDragOptionsIf.managed).

moved: boolean = false

true if the moved rows changed in the table (managed mode, "end", not prevented).

originalEvent?: PointerEvent | KeyboardEvent

The browser event behind this event (pointer or keyboard).

outside: boolean

true if the pointer is outside the table – e.g. over an own drop zone of the page.

rowIndices: number[]

Display indices of the dragged rows when the drag started (ascending).

rows: T[]

The dragged row objects (tree: the TreeRows) in display order.

Pointer or keyboard.

target: undefined | RowDropTargetIf

The current drop target – undefined if there is none (invalid, vetoed, outside the table).

toIndex: number

Flat tables: display index of the first dragged row after the drop (0 = first row), -1 without target. Trees: -1 before the move; in a managed "end" the index the row really got.

Phase of the drag.

Accessors

Methods