combo.*

3 min read

Combo inherits from Node. The functions of Node are also available for Combo. This document will only introduce the common functions for Combo Class. All the built-in combos can be found in Built-in Combos Doc and demo, Custom Combo can be found in Custom Combo Doc and demo.

combo.getChildren()

Get all children including sub nodes and sub combos.

Return

  • Return the collection of Node and Combo: { nodes: INode[], combos: ICombo[] }

Usage

const elements = combo.getChildren();

combo.getNodes()

Get sub nodes of the combo。

Return

  • The type of return value: INode[].

combo.getCombos()

Get sub combos of the combo。

Return

  • The type of return value: ICombo[].

combo.addChild(item: INode | ICombo)

Add the item (Node or Combo) into the Combo as its child.

Parameters

NameTypeRequiredDescription
itemINode / ICombotrueThe item of node or combo

Return

  • The type of return value: boolean;
  • Return true to indicate successful executed.

Usage

const node = graph.findById('node1');

// Return true to indicate successful executed.
const result = combo.addChild(node);

combo.addNode(node: string | INode)

Add the Node to the Combo.

Parameters

NameTypeRequiredDescription
nodestring / INodetrueNode ID or the item of the node

Return

  • The type of return value: boolean;
  • Return true to indicate successful executed.

combo.addCombo(combo: ICombo)

Add a sub combo into the combo as the its child.

Parameters

NameTypeRequiredDescription
comboICombotrueThe item of the combo

Return

  • The type of return value: boolean;
  • Return true to indicate successful executed.

combo.removeChild(item: ICombo | INode)

Remove the child item (a Node or a Combo).

Parameters

NameTypeRequiredDescription
itemINode / ICombotrueThe item of node or combo

Return

  • The type of return value: boolean;
  • Return true to indicate successful executed.

combo.removeCombo(combo: ICombo)

Remove a sub combo from the parent. The combo will still exist on the graph but it is not belong to the parent combo any more. If you want to delete the combo from the graph, call graph.removeItem instead

Parameters

NameTypeRequiredDescription
comboICombotrueThe item of Combo

Return

  • The type of return value: boolean;
  • Return true to indicate successful executed.

combo.removeNode(node: INode)

Remove a child node from the combo. The node will still exist on the graph but it is not belong to the combo any more. If you want to delete the node from the graph, call graph.removeItem instead

Parameters

NameTypeRequiredDescription
nodeINodetrueNode ID or the item of Node

Return

  • The type of return value: boolean;
  • Return true to indicate successful executed.

Comparison for Combo and Hull

combo-hull