Skip to Content
avatar image
Former Member

How to get the pressed item value of Tree UI Element??

There is a tree like below:

Tree

Treenode1

tree_item1

tree_item2

Treenode2

tree_item3

tree_item4

tree_item5

how can I get the value of tree_item1,2,3... after they were been pressed?? Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 06, 2007 at 04:01 AM

    Hi,

    What exactly do you mean by When they were pressed. lead selected or do you have any link.

    If you want to get the lead selected element, simply you can use node->get_lead_selection( ) which returns you element and using get_static_attributes( ) method you can get the values of that element.

    If you want ot get the value when you press some link, have an action handler for that link and in the action handler method you can get the current element using wdevent's get_context_element method ( wdevent->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ) which returns element. From element you can get values using get_static_attributes or get_attribute methods.).

    Thanks,

    Prasahnth

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks,Prasahnth, in this tree, there is one leaf name 'SFLIGHT', after click this leaf, value 'SFLIGHT' will be got and to be showed with ALV control.

      I just need to get the value 'SFLIGHT', that is the table will be output by ALV later.

      could you please show some example codes of this? thanks once more.

  • avatar image
    Former Member
    Jun 06, 2007 at 05:49 AM

    Hi,

    Define an event handler for the OnAction event of the tree. The method would have wdevent as an importing parameter. You can use the method call wdevent->get_string('ID'), which will return the UI element ID of the item that has been clicked. Else you can use wdevent->get_context_element( ).

    Refer to the webdynpro component WDR_TEST_EVENTS that has various types of trees. Hope this helps.

    Regards,

    Nithya

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 06, 2007 at 06:04 AM

    Thanks all, I had got the value by below codes:

    data parent_element TYPE REF TO if_wd_context_element.

    parent_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).

    parent_element->get_attribute( EXPORTING name = 'VALUE' IMPORTING value = tablename ).

    then the table name is 'SFLIGHT", just what I need.

    Thanks so much for your kind help!!!

    Add comment
    10|10000 characters needed characters exceeded