JavaScript Data GridDragToScroll
Description
Plugin used to scroll Handsontable by selecting a cell and dragging outside of the visible viewport.
Options
dragToScroll
Source codedragToScroll.dragToScroll : boolean
The dragToScroll
option configures the DragToScroll
plugin.
You can set the dragToScroll
option to one of the following:
Setting | Description |
---|---|
true (default) | When selection reaches the edge of the grid's viewport, scroll the viewport |
false | Don't scroll the viewport |
Read more:
Default: true
Example
// when selection reaches the edge of the grid's viewport, scroll the viewport
dragToScroll: true,
Members
boundaries
Source codedragToScroll.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 codedragToScroll.check(x, y)
Checks if the mouse position (X, Y) is outside 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 codedragToScroll.destroy()
Destroys the plugin instance.
disablePlugin
Source codedragToScroll.disablePlugin()
Disables the plugin functionality for this Handsontable instance.
enablePlugin
Source codedragToScroll.enablePlugin()
Enables the plugin functionality for this Handsontable instance.
isEnabled
Source codedragToScroll.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
then the DragToScroll#enablePlugin method is called.
setBoundaries
Source codedragToScroll.setBoundaries([boundaries])
Sets the boundaries/dimensions of the scrollable viewport.
Param | Type | Description |
---|---|---|
[boundaries] | DOMRect Object | optional An object with coordinates. Contains the window boundaries by default. The object is compatible with DOMRect. |
setCallback
Source codedragToScroll.setCallback(callback)
Changes callback function.
Param | Type | Description |
---|---|---|
callback | function | The callback function. |
updatePlugin
Source codedragToScroll.updatePlugin()
Updates the plugin's state.
This method is executed when updateSettings()
is invoked with any of the following configuration options: