Skip to main content

collapseItem()

Description

Hides all children of the target shape or collapses the group/swimlane

Usage

collapseItem(
id: string | number,
dir?: string
): void;

Parameters

  • id - (required) the ID of the item
  • dir - (optional) defines the side, the children will be hidden in relation to the root shape: "left", or "right".
    note

    The dir parameter can be used only when the diagram is initialized in the mindmap mode (type:"mindmap")

Example

const diagram = new dhx.Diagram("diagram_container", {
type: "default"
});
diagram.data.parse(data);

diagram.collapseItem(123);

or

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

diagram.collapseItem("main", "left");

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

Related articles: Expanding/collapsing items