cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Lead selection of an Item in Tree node

Former Member
0 Kudos

Hi Experts,

I have a Tree in which there are Two Tree nodes and two Tree leaves in each node. When I select the first leaf of the first node, the tree leaf is getting highlighted (like in lead selection).

Node 1

Leaf 1................................>selected and highlighted

Leaf 2

Node 2

Leaf 1

Leaf 2

But when I select the second node's leaf, both are getting highlighted.

Node 1

Leaf 1................................>Not selected but still highlighted

Leaf 2

Node 2

Leaf 1................................>selected and highlighted

Leaf 2

However onAction of the corresponding leaf (in this case, ONAction of Node2.Leaf1) is getting triggred. I need the first selection to be removed when we select another item.Selection Property of Node and Leaf is 0..1.Kindly suggest me a way to correct this. Thank you.

Warm Regards,

Jenny Karunakaran

Edited by: Jenny Karunakaran on Jun 2, 2010 1:09 PM

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

hi, all:

About the issue, i have also encountered in my real project, In my project, the issue comes from:

My tree node is recursion node. If i press the lower node, then the upper node will also be highlighted(just like "selected").

At last, we research and debug, we found: the problem is because "Lead selection" is used improperly.

Eventually, i choose the following method to set the lead selection, do not use the such as "set_lead_selection(context_element)" !.

You can check and try this coding. This is just one example:

It makes use of the "Path" of "WDEVENT" of "press action" of the Tree.


"parameters:
I_PATH                                     importing     STRING

method PATH_LEAD_SELECTION .

  data:
      lt_string type TABLE OF string,
      lo_string type string.
* get the string of path
  SPLIT i_path at '.' into TABLE lt_string.

  data:
    is_node type wdy_boolean,
    nodepath type string,
    node type REF TO if_wd_context_node,
    inde type i.

  is_node = abap_true.
  loop at lt_string into lo_string.
* form the Node-path
    IF nodepath is initial.
      nodepath = lo_string.
    ELSE.
      CONCATENATE nodepath lo_string into nodepath SEPARATED BY '.'.
    ENDIF.

* set lead selection of every node in the Path
    if is_node = abap_true.
      node = wd_context->path_get_node( nodepath ).
      is_node = abap_false.
    else.
      CALL FUNCTION 'CONVERT_STRING_TO_INTEGER'
          EXPORTING      P_STRING        = lo_string
          IMPORTING      P_int        = inde.
      node->set_lead_selection_index( inde ).
      is_node = abap_true.
    endif.

  ENDLOOP.

Best wishes.

Former Member
0 Kudos

Hi,

please use the below code to unselect the tree nodes, I am also using the same code, it is working fine.

lo_nd_node_oa_level1->set_lead_selection_index( if_wd_context_node=>no_selection ).

Regards,

Naresh.

faebulicious
Explorer
0 Kudos

i have exactly the same problem. my lead selection is initialized and i set my tree to "manuall" selectionby default and it still happens.

i also tried to initialize the lead selection in the action handler, afteraction and also modifyview, but i allways got a dump. it seems that the tree internally needs the leadselection to render a delta....

i think its an error in the tree control.

Former Member
0 Kudos

Hi friend,

Just uncheck the "initialize lead selection" checkbox of the context node which is bound to the tree and you're done.

Thanks,

Duy

Former Member
0 Kudos

Hi ,

Specify 'node_selection_mode' property of Constructor while creating tree control.

refer code:

  • create tree control

CREATE OBJECT go_tree

EXPORTING

parent = go_container

node_selection_mode = cl_gui_column_tree=>node_sel_mode_single

item_selection = 'X'

no_toolbar = ''

no_html_header = ''.

Joseph_BERTHE
Active Contributor
0 Kudos

Hi,

I have se same requirement, if you find out the solution I'm open for it

Regards