Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Expand all child nodes of the recursive tree

Hi everybody,

I have a problem by implementing of the action to expand all child nodes of the recursive tree and need your help.

I used the TuTWD_Tree example project provided by SAP. What I want to reach is to expand all the child nodes of the recursive tree (TheTree) by clicking the ToolBarButton.

I did the following jobs:

- I added a ToolBarButton named "EXPAND" in the TreeView.

- Then I implemented the onActionExpandNodes(). The codes I wrote in the onActionExpandNodes are as following:

...

IPrivateTreeView.ITreeNodeNode rootNode = wdContext.nodeTreeNode();

for (int i = 0; i < rootNode.size(); i++){

IPrivateTreeView.ITreeNodeElement element = (IPrivateTreeView.ITreeNodeElement)rootNode.

getElementAt(i);

element.setIsExpanded(true);

IPrivateTreeView.ITreeNodeNode subNode = element.nodeChildNode();

if (!subNode.isEmpty()){

for(int n = 0; n < subNode.size(); n++){

IPrivateTreeView.ITreeNodeElement element1 = (IPrivateTreeView.ITreeNodeElement)subNode.getElementAt(n);

if (element1 != null){

element1.setIsExpanded(true);

}

}

}

}

...

After deploying and running the project I see that the twisty icon before the driver "C" and the drive "D" and the direct child folder "Games" are expanded when I clicked the "EXPAND" ToolBarButton. The other folders under C or D are not expanded. Certainly there are somethings uncorrect but I do not know what.

Are there anyones who already have experience on this topic?

Please give me your advices!

Thank you in advance!

Bye

Thao

PS.

##############################################################

##

    1. Filesystem resources for Web Dynpro Tutorial Tree

##

##############################################################

Drives = C;D

C = Documents;Program_Files;Temp;Windows;start.bat

Documents = Word;calc.xls;db.mdb

Word = first.doc;second.doc

Program_Files = Winzip;Accessories

Winzip = wz.com;wzinst.hlp;test.zip

Accessories = calculator.exe;notepad.exe;paint.exe

Windows = Java;Temporary_Internet_Files

Java = app.java;app.class

Temporary_Internet_Files = cookie1.txt;cookie2.txt;cookie3.txt;cookie4.txt

D = Games

Games = Soccer;Chess

Soccer = soccer.exe;field.lnd

Chess = chess.exe

Former Member
Not what you were looking for? View more on this topic or Ask a question