This page covers a next version of Handsontable, and is not published yet.

This page covers a non-latest version of Handsontable.

# DragToScroll

# Description

Plugin used to scroll Handsontable by selecting a cell and dragging outside of the visible viewport.

# Options

# dragToScroll

Source code (opens new window)

dragToScroll.dragToScroll : boolean

Disables or enables the DragToScroll functionality.

Default: true Example

// don't scroll the viewport when selection gets to the viewport edge
dragToScroll: false,

# Members

# boundaries

Source code (opens new window)

dragToScroll.boundaries : DOMRect

Size of an element and its position relative to the viewport, e.g. {bottom: 449, height: 441, left: 8, right: 814, top: 8, width: 806, x: 8, y:8}.

# Methods

# check

Source code (opens new window)

dragToScroll.check(x, y)

Checks if the mouse position (X, Y) is outside of the viewport and fires a callback with calculated X an Y diffs between passed boundaries.

Param Type Description
x number Mouse X coordinate to check.
y number Mouse Y coordinate to check.

# destroy

Source code (opens new window)

dragToScroll.destroy()

Destroys the plugin instance.

# disablePlugin

Source code (opens new window)

dragToScroll.disablePlugin()

Disables the plugin functionality for this Handsontable instance.

# enablePlugin

Source code (opens new window)

dragToScroll.enablePlugin()

Enables the plugin functionality for this Handsontable instance.

# isEnabled

Source code (opens new window)

dragToScroll.isEnabled() ⇒ boolean

Checks if the plugin is enabled in the handsontable settings. This method is executed in Hooks#beforeInit hook and if it returns true than the DragToScroll#enablePlugin method is called.

# setBoundaries

Source code (opens new window)

dragToScroll.setBoundaries(boundaries)

Sets the value of the visible element.

Param Type Description
boundaries DOMRect An object with coordinates compatible with DOMRect.

# setCallback

Source code (opens new window)

dragToScroll.setCallback(callback)

Changes callback function.

Param Type Description
callback function The callback function.

# updatePlugin

Source code (opens new window)

dragToScroll.updatePlugin()

Updates the plugin state. This method is executed when Core#updateSettings is invoked.

Last Updated: Mar 27, 2024