cancel
Showing results for 
Search instead for 
Did you mean: 

Expand/Collapse All functionality in TREE UI Element

Former Member
0 Kudos

Hi All,

I'm using Tree UI Element in which Collapse All button is coming defaultly in that Tree Application . But i need to know how the function is taking place behind . Because i need to refer to do it for Expand All scenario for the same tree . Is that collapse is refering to any method in class ? . Can anyone brief out the coding of that . Or if anyone knows the coding of Expand all pls refer to me,

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Ramesh Vinay,

*Create a node which has attributes (EXPANDED, IS_LEAF,ROW_KEY and PARENT_ROW_KEY) to build a tree.

Following code will be executed when COLLAPSE ALL button is clicked.

DATA: lo_nd_tree TYPE REF TO if_wd_context_node,

lt_elements TYPE wdr_context_element_set.

FIELD-SYMBOLS:

<lo_element> TYPE REF TO if_wd_context_element.

lo_nd_tree = wd_context->get_child_node( name = wd_this->wdctx_tree).

lt_elements = lo_nd_tree ->get_elements( ).

LOOP AT lt_elements ASSIGNING <lo_element>.

<lo_element>->set_attribute(

EXPORTING value = abap_false

name = u2018EXAPNDEDu2019 ).

ENDLOOP.

Following code will be executed when EXPAND ALL button is clicked.

DATA: lo_nd_tree TYPE REF TO if_wd_context_node,

lt_elements TYPE wdr_context_element_set.

FIELD-SYMBOLS:

<lo_element> TYPE REF TO if_wd_context_element.

lo_nd_tree = wd_context->get_child_node( name = wd_this->wdctx_tree).

lt_elements = lo_nd_tree ->get_elements( ).

LOOP AT lt_elements ASSIGNING <lo_element>.

<lo_element>->set_attribute(

EXPORTING value = abap_true

name = u2018EXAPNDEDu2019 ).

ENDLOOP.

Reply me if you have any questions.

Thanks,

Bharath.K

Former Member
0 Kudos

Hello Bharath ,

Thanx for ur helpful reply.

Collapse all functionality is working fine . But in expand all , initially it expands only the first folder , after then it expands only to the point where i have last left behind with my manual extension to that point.

Suggest sny solutions where i have done wrong.