Reputation: 17
How to programmatically expand the only single node in sap.m.Tree control? JSONModel.
In example http://embed.plnkr.co/jb9tggpFhv4DHg69785v/
Here I want to expand only node 1.2.1 without expanding all unneeded nodes.
Upvotes: 1
Views: 3004
Reputation: 1
To expand one or more tree nodes programmatically, try the API sap.m.Tree#expand
:
var selectItemIndex = oTree.indexOfItem(mySelectedItem);
oTree.expand(selectItemIndex);
Sample: https://sdk.openui5.org/entity/sap.m.Tree/sample/sap.m.sample.TreeExpandMulti
Upvotes: -1
Reputation: 3457
in your sample add this line :
oTree.onItemExpanderPressed(oTree.getItems()[1], true)
after the oTree.place
This will expand the second item
Upvotes: -1