Skip to content
Latestv1.0.60

Table - Row Drag

Configure row drag functionality through drag-config, supporting drag sorting, drag handles, drag event listening, and more.

Drag to Reorder Rows

Set row: true in drag-config to enable row drag sorting. Press and hold the row with the mouse to drag.

Drag to Reorder Rows

Custom Drag Handle

Specify the CSS selector of the drag handle via drag-config.handle. Dragging is only triggered within the handle area to prevent accidental operations.

Drag Handle

Frozen Columns + Drag

Row dragging can be used in conjunction with frozen columns (fixed).

Frozen Columns + Row Drag

Drag Events

Obtain drag state information through the onDragStart and onDragEnd callbacks of drag-config, or by listening to the drag-end event.

Drag Events

Tree Data Drag

Row dragging can be used with tree data (tree-config), supporting drag-and-drop tree nodes to adjust the order.

Tree Data Drag

API

DragConfig

Passed through the drag-config property.

PropertyDescriptionTypeDefault
rowWhether row dragging is enabledbooleanfalse
columnWhether column dragging is enabledbooleanfalse
handleCSS selector for the drag handlestring
animationAnimation duration (ms)number150
onDragStartDrag start callback({ type, data, index }) => void
onDragEndDrag end callback({ type, oldIndex, newIndex, data }) => void
crossTableWhether cross-table dragging is supportedbooleanfalse
dragClassStyle class during draggingstring
ghostClassGhost element style classstring

Events

EventDescriptionParameters
drag-endTriggered when dragging ends{ type: 'row' | 'column', oldIndex: number, newIndex: number, data: unknown[] }

onDragStart Parameters

ParameterDescriptionType
typeDrag type'row' | 'column'
dataDragged recordunknown
indexDragged indexnumber

onDragEnd Parameters

ParameterDescriptionType
typeDrag type'row' | 'column'
oldIndexOriginal indexnumber
newIndexNew indexnumber
dataData after drag (reordered array)unknown[]

Released under the MIT License.