Skip to main content

onBeforeTaskDrag

Description

Fires after the user has pressed the mouse button and started dragging, but before dhtmlxGantt starts the drag-and-drop operation

onBeforeTaskDrag: (id: string | number, mode: string, e: Event) => boolean;

Parameters

  • id - (required) string | number - the task id
  • mode - (required) string - the drag-and-drop mode ("resize", "progress", "move", "ignore")
  • e - (required) Event - a native event object

Returns

  • result - (boolean) - defines whether the default action of the event will be triggered (true) or canceled (false)

Example

gantt.attachEvent("onBeforeTaskDrag", function(id, mode, e){
//any custom logic here
return true;
});

Details

The event fires when the user drags a task in the timeline area.

The event is blockable. Return false and the task will be backed to the initial position.