The user moves a column by dragging its header (EventListenerIf.onColumnMoveStart, EventListenerIf.onColumnMoveEnd).

One start and one end per drag – no event for the steps in between (the table moves the column while the mouse moves). Only user actions report it, not TableApi.applyState or tableModel.changeColumnOrder(). The end comes after the table applied the order: in the handler tableApi.getTableModel().getColumnDefs() and TableApi.getState already have it.

Example

const listener = new EventAdapter();
listener.onColumnMoveEnd = (evt: GeColumnMoveEvent) => {
if (evt.moved) {
localStorage.setItem("column-order", JSON.stringify(evt.columnOrder));
}
};

Since

1.1.110

Hierarchy

  • GeColumnMoveEvent

Constructors

  • Parameters

    • type: GeColumnDragEventType

      Phase: "start", "end" or "cancel" (Escape: the old order is back).

    • fromIndex: number

      Model index of the column when the drag started.

    • toIndex: number

      Model index of the column now ("start" and "cancel": fromIndex; "end": also when it did not change).

    • columnDef: undefined | ColumnDefIf

      The column definition of the dragged column.

    • property: undefined | string

      The property of the dragged column (columnDef.property).

    • columnOrder: string[]

      The properties of all columns in the order now (after the move for "end").

    • Optional originalEvent: Event

      The browser event behind it (mouse up; undefined for TableApi.cancelColumnDrag).

    Returns GeColumnMoveEvent

Properties

columnDef: undefined | ColumnDefIf

The column definition of the dragged column.

columnOrder: string[]

The properties of all columns in the order now (after the move for "end").

fromIndex: number

Model index of the column when the drag started.

originalEvent?: Event

The browser event behind it (mouse up; undefined for TableApi.cancelColumnDrag).

property: undefined | string

The property of the dragged column (columnDef.property).

toIndex: number

Model index of the column now ("start" and "cancel": fromIndex; "end": also when it did not change).

Phase: "start", "end" or "cancel" (Escape: the old order is back).

Accessors