fires before a drag operation in the Gantt chart is started

boolean onBeforeDrag(object task,object context);
taskobjecttask object
contextobjectan object with drag context
booleanreturning false will prevent any drag operation in the chart


$$("gantt1").attachEvent("onBeforeDrag", function(task, context) {
  const name = item.text || "(no title)";
  const mode = context.mode;
  if (mode == "move") {
    webix.message("'" + name + "' is being moved");
  // ...

Related samples


The context object includes the mode field that stores the drag mode with the following values possible:

  • "move" - when task dragging started: both start and end date are going to be changed
  • "start" / "end" - when task is being resized: start or end date is going to be changed
  • "progress" - when task progress is being dragged
  • "link" - when drag for link creation started (for this mode context includes also fromStart that shows whether the link starts from the task start).

Returning false from the event handler will block any drag operation with tasks on the chart (link creation, changing task progress, etc).

$$("gantt1").attachEvent("onBeforeDrag", function(task, context) {
  return false;

Note the event only fires for chart tasks and is not triggered when tree items are being dragged.

See also
Back to top