cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch the index of the node in a tree

0 Kudos

hi,

i am using a recursive tree structure,

i need to get the index value of a selected node in a tree structure,

can any one help me?

thanks in advance,

Regards,

Meyyappan

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hello Ganesh,

just add parameter CONTEXT_ELEMENT of type IF_WD_CONTEXT_ELEMENT to the action handler. It

contains a pointer to the currently selected context element. From it, you can get the index.

Best regards,

Thomas

0 Kudos

hello Thomas,

thanks for ur reply ,

i had added tat parameter CONTEXT_ELEMENT of type IF_WD_CONTEXT_ELEMENT to the action handler.

It's giving the index but my requirement is to fetch the index of the parent node for this current node

this context_element gives the index value of this node level only not its parent node.

Regards,

Ganesh

thomas_szcs
Active Contributor
0 Kudos

Hello Ganesh,

in that case, just call


  lr_node_tmp = context_element->get_node().
  lr_parent_element = lr_node_tmp->get_parent_element().
  lr_parent_node = lr_parent_element->get_node().

Best regards,

Thomas

0 Kudos

hello Thomas,

thanks for ur valuable reply,

Problem solved

Regards,

Ganesh

Answers (1)

Answers (1)

Yashpal
Active Contributor
0 Kudos

Hi ,

In the Action handler eg. OnAction of the tree .. check the object WDEVENT u will get the index or the context element..

Regards

Yash