TreeModel class

TreeModels support tree-structured graphs of nodes and links. Each node can have at most one "tree parent"; cycles are not permitted. The reference to the parent node's key is a property of the child node data.

TreeModels, unlike GraphLinksModels, do not support arbitrary link relationships between nodes, nor is there a separate link data object for each parent-child relationship. Furthermore there is no support for grouping or label nodes.

The #nodeParentKeyProperty property names the property on the node data whose value is the key of the "tree parent" node. The default value for this property is "parent".

For example, one can define a graph consisting of one parent node with two child nodes:

 model.nodeDataArray = [
   { key: "Alpha" },
   { key: "Beta", parent: "Alpha" },
   { key: "Gamma", parent: "Alpha" }
 ];

If you need to show a more complicated graph structure than a tree, use a GraphLinksModel. If you want to have multiple links between the same pair of nodes, or if you want to associate more information with each link and cannot put the information on the child node, you will need to have a separate link data object for each link, and that would require the use of GraphLinksModel.

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

TreeModel.$1()
factory
TreeModel.$2([dynamic init])
factory
TreeModel.$3([Array<Object>? nodedataarray, dynamic init])
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited