onBeforeEventDrag

fires before an event is being dragged

boolean onBeforeEventDrag(object context,object event);
contextobjectan object with drag context
eventobjectHTML event
booleanreturning false will block drag operations

Example

$$("scheduler1").attachEvent("onBeforeEventDrag", function(context, e) {
  webix.message(`onBeforeEventDrag for <br/>${context.event.text || "(No title)"}`);
 
  const mode = this.getState().mode;
  if (mode === "week") {
    webix.message("Custom DnD restriction in Week mode", "error");
    return false;
  }
});

Related samples

Details

The context object contains the following fields:

  • event (object) - an event object
  • id (string) - event ID
  • $resize (boolean) - optional. true if event is resized in Day mode
  • from (object) - information about source of Drag-n-Drop
  • node (node) - a node of the dragged event
  • target (node) - optional. Target of drag event (only in Day and Week modes).

Returning false from the event handler will block drag operations in Scheduler.

$$("scheduler1").attachEvent("onBeforeEventDrag", function(context, e) {
  return false;
});
See also
Back to top