Skip to main content

beforeGroupMove

Description

Fires before a group or swimlane is moved

Usage

beforeGroupMove: (
event: MouseEvent,
id: string | number,
coord: object
) => boolean | void;

Parameters

The callback of the event takes the following parameters:

  • event - (required) a native HTML event object
  • id - (required) the id of an item
  • coord - (required) am object with the x and y coordinates of the group or swimlane position before movement

Returns

Return false to prevent the group or swimlane from being moved; otherwise, true

Example

// initializing Diagram Editor
const editor = new dhx.DiagramEditor("editor_container");
// loading data
editor.parse(data);

// attaching a handler to the event
editor.events.on("beforeGroupMove", (event, id, coordinates) => {
console.log(`
Group ${id} is position:
x: ${coordinates.x}
y: ${coordinates.y}
`);
return true;
});

Change log: Added in v4.0