Skip to main content

afterExpand

Description

Fires after an item has been expanded

Usage

afterExpand: (
id: string | number,
dir?: string
) => void;

Parameters

The callback of the event takes the following parameters:

  • id - (required) the id of an item which has been expanded
  • dir - (optional) the side the children were shown in relation to the parent shape ("left" or "right" for type:"topic", otherwise - undefined)

Example

// initializing Diagram
const diagram = new dhx.Diagram("diagram_container", {
type: "mindmap"
});
// loading data
diagram.data.parse(data);

// attaching a handler to the event
diagram.events.on("afterExpand", function(id, dir) {
console.log(diagram.data.getItem(id).text + " was expanded", dir);
});

Change log: The dir parameter has been added in v3.1

Related sample: Diagram. Org chart mode. Events