cancel
Showing results for 
Search instead for 
Did you mean: 

WD Tree Expand Leadselection?

0 Kudos

Hello community,

i have a question about the Tree UI element.

What do i have to do if i want to expand the tree nodes to see my seleted item?

If i set the lead selection, i can see the parents marked, but i cant get them expanded.

Is there a way to expand a single tree node?

Please dont answer "Click at the arrow in front of it".

A hint or a line of code would be very useful, thank you

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Nobody knows how do expand/open a specific treenode?

Former Member
0 Kudos

Does your tree structure has some attribute of type boolean

if not then create an attribute ex. is_expanded of type wdy_boolean and then while forming the tree you can set this attribute property to abap_true for folder.

You can then bind this attribute is_expanded to expanded property of your master column.

Hope this helps you.

example code - here based on some selection i'm marking my tree node as expanded

*for entity, read from dt_entries, if found then expand this folder
      READ TABLE dt_entries INTO ls_entry WITH KEY name = ls_ent_att-usmd_entity parent_name = ls_ent_att-parent_entity.
      IF sy-subrc = 0.
        ls_entry-intfmodelcheck = abap_true.
        ls_entry-is_expanded = abap_true.
        MODIFY dt_entries FROM ls_entry INDEX sy-tabix TRANSPORTING intfmodelcheck is_expanded .
      ENDIF.

Regards

manas dua

Answers (2)

Answers (2)

0 Kudos

Thank you very much.

I just wondered why the Expanded propertie just didnt work if I set it to true in the layout creation.

But now it works perfectly

Former Member
0 Kudos

hi,

Refer this thread :

0 Kudos

Hello,

thanks for the fast answer.

The problem is not setting up the tree.

I already got the tree with all entries i need, recursive child node etc.

My program does search inside the tree for a specific node and if it finds one , it sets the node's lead selection.

But the Tree keeps beeing compressed but i need it to show the element not just the 1. Level parent

Edited by: Dominik Keil on Oct 14, 2009 9:22 AM

Former Member
0 Kudos

hi,

Please refer the Standard SAP Component : WDT_TREE

May be it is useful for u.

0 Kudos

I already got my table similar to wdt_tree example but imagine if you want to create a new "file" in to the table and refresh it. After that refresh you want to see the selected entry inside the tree.

here is my example:

CONTEXT and TREE

ROOT

--->Folder A

--->Folder B

-


>FileA

You create a new file.

then you context has the following Structure:

CONTEXT

ROOT

--->Folder A

--->Folder B

-


>FileA

-


>_FileB_

but the tree is displayed like following.

TREE

ROOT

--->Folder A

---> Folder B

-


>FileA

and you want you programm to refresh the tree, maybe someone else inserted a new file too and after that u want your new file beeing selected.

I do refresh my tree and set the lead selection to my new file and all i see is:

(Selecion is marked with underline)

Tree

ROOT

--->Folder A

--->_Folder B_

But the lead_selection is:

Context

ROOT

--->Folder A

--->_Folder B_

-


>FileA

-


>_FileB_

and i want to get the Node Folder B expanded via code. I hope you could follow my confusing explaination

Edited by: Dominik Keil on Oct 14, 2009 10:55 AM