endrx
endrx

Reputation: 17

How to expand a single sap.m.Tree item multiple levels?

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

Answers (2)

Nikhitha P
Nikhitha P

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

Ji aSH
Ji aSH

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

Related Questions