Skip to main content

afterCollapse

Description

Fires after an item has been collapsed

Usage

afterCollapse: (
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 collapsed
  • dir - (optional) the side the children were hidden 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: "default"
});
// loading data
diagram.data.parse(data);

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

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

Related article: Event handling

Related sample: Diagram. Org chart mode. Events