HasChild: Boolean
The HasChild property determines whether tree node has any child element.
Available values:
true. Tree has child elements;
false. Tree has no child elements.
Use JSON or the setHasChild method to set the property value, and the getHasChild method to get the property value.
To execute the example, the page must contain the TreeList component named «treeList» (see Example of Creating the TreeList Component). Determine whether node with the Africa contents has child elements:
// Get the node with the Africa contents var nodeAfrica = treeList.findText("Africa"); // Determine whether the node with the Africa contents has child elements if (nodeAfrica.getHasChild()) { console.log("Node with the Africa contents has child elements"); } else { console.log("Node with the Africa contents has no child elements"); }
The result of the node checking is displayed to the console:
Node with the Africa contents has child elements
See also: