Skip to main content

itemTarget

info

The event works only in the org chart and mindmap modes of Diagram, the itemsDraggable property must be set to true.

The event doesn't work with the parent item of the moved item and with the moved item with the property giveItem: false.

Description

Fires when the moved item is under the target item

Usage

itemTarget: (
movedId: string | number,
targetId: string | number,
event: MouseEvent
) => boolean | void;

Parameters

The callback of the event takes the following parameters:

  • movedId - (required) the id of the moved item
  • targetId - (required) the id of the target item
  • event - (required) a native HTML event object

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("itemTarget", (movedId, targetId, event) => {
console.log("itemTarget", movedId, targetId, event);
});

Change log: Added in v4.1