SpreadJS 14
Features / Cells / Drag and Move
In This Topic
    Drag and Move
    In This Topic

    SpreadJS supports using the mouse to drag and move cells or blocks of cells.

    The user can use the mouse to select a cell or block of cells and move them to a new location. Move the pointer to the edge of a selected column, row, or block of cells and then click and drag the selected range to the new location.

    The following image displays a selected block of cells with the drag icon:

    Selected block of cells

    Move the block to the new location.

    Dragging the cell block

    Release the mouse to display the data in the new location.

    Dropping the cell block

    You can select and drag multiple contiguous columns or rows.

    You can prevent or allow the user to drag and move with the options.allowUserDragDrop property.

    Using Code

    This example allows the user to drag and drop cells.

    Copy Code
    $(document).ready(function ()
        var spread =
        new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
        var sheet = spread.getActiveSheet();
        // Enable drag and drop of cells
        spread.options.allowUserDragDrop = true;
        sheet.setValue(0, 0, "Text");
    See Also