fires before a drop operation in the Gantt chart

boolean onBeforeDrop(object task,object context){ ... };


taskobjecttask object
contextobjectan object with drop context


booleanreturning false will prevent any drop operation in the chart


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

Related samples


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

  • "move" - when bar is going to be dropped: both start and end date are changed
  • "start" / "end" - when task is resized: start or end date is changed. In this mode the context object contains the "timeShift" field that defines the direction start/end date is changed in
  • "progress" - when a task progress drag-n-drop finished. In this mode the context object contains the "progress" field that stores progress indicator
  • "link" - when link is established. In this mode the context object also includes:
    • targetId - target task id
    • linkType - defines link type:
      • 0 - "end-to-start"
      • 1 -"start-to-start"
      • 2 - "end-to-end"
      • 3 - "start-to-end".

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

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

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

See also
Back to top