This is a documentation of an earlier version of Handsontable.

# Row moving

# Overview

This page shows how to move rows in Handsontable.

# Enabling plugins

To enable move features, set manualRowMove: true.

A draggable move handle appears above the selected row header. You can click and drag it to any location in the row header body.

    # Drag and move actions of manualRowMove plugin

    There are significant differences between the plugin's dragRows and moveRows API functions. Both of them change the order of rows, but they rely on different kinds of indexes. The differences between them are shown in the diagrams below.

    TIP

    Both of these methods trigger the beforeRowMove and afterRowMove hooks, but only dragRows passes the dropIndex argument to them.

    The dragRows method has a dropIndex parameter, which points to where the elements are being dropped.

    dragRows method

    The moveRows method has a finalIndex parameter, which points to where the elements will be placed after the moving action - finalIndex being the index of the first moved element.

    moveRows method

    The moveRows function cannot perform some actions, e.g., more than one element can't be moved to the last position. In this scenario, the move will be cancelled. The Plugin's isMovePossible API method and the movePossible parameters beforeRowMove and afterRowMove hooks help in determine such situations.