getItemKey(index);
index. Node index which key is to be returned.
The getItemKey method returns node key by index.
To execute the example, the page must contain the TreeList component named «treeList» (see Example of Creating the TreeList Component). Get the key of the first tree root node:
// Get the key of the first tree root node console.log("Key of the first tree root node: " + treeList.getNodes().getItemKey(0));
As a result, the key of the first root node is displayed to the console:
Key of the first tree root node: 0
See also: