Skip to main content

beforeDrag

fires before dragging of an item has started

beforeDrag: (data: IDragInfo, events: MouseEvent, ghost: HTMLElement) => void | boolean;

Parameters:

  • data: object - data object
  • events: MouseEvent - a native HTML event object
  • ghost: HTMLElement - an HTML element

Returns:

Return false to block dragging of an item; otherwise, true.

Example

tree.events.on("BeforeDrag", function(data, events) {    // your logic here    return false;});

Related sample: Tree. Events

The data object can contain the following parameters:

start(string, number) the id of an item, from which the dragging process has started
source(array) an array with ids of dragged items
target(string, number) the id of a potential target item

Change log:

added in v7.0