cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the selected Item in a Tree?

Former Member
0 Kudos

Hello!

In my application i use a Tree (which is finally working now after trying hard over 3 days gg).

Now i don't know how to access a Tree item.

I want to use a button, when i click this button i want to get the selected item in the tree...but how to?

My second question is:

Is there a way to utilize a "double-click" event?

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

could you explain "saving it in the controller" ?

Shall i add the same attributes to the context again, and fill them with data on a tree onAction?

Is there no way to Access the tree in an on Action element from a Button??

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

go to the attributes tab and add the variable

value type string

and access it in Event Handler using

Wd_this->value

you can access this variable anywhere in the View controller

Abhi

Answers (3)

Answers (3)

Former Member
0 Kudos

yes thats what i did,

I added an Attribute of type if_wd_context_element and this works fine for me.

thanks.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

If your problem solved, you can close the thread

Abhi

Former Member
0 Kudos

Hi Abhi.

I know the Tree event On Action.

But i want to get the selected item when i click a button.

I'm don't understand how to do this.

Do i have to use the Tree event on Action and then maybe save the value in a global context attribute? (i think this would work but I'm sure there is a way to access the treeitem directly)

I didn't understand your example with the path.

for example: my tree looks like

TREE_ROOT

-NODE1

-- NODE1 recursiv

-- NODE1_ITEM

-


TEXT

-- TEXT

-- HAS_CHILDREN

thanks for the help

Edited by: Thomas Roithmeier on Jul 29, 2008 10:17 AM

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Use OnAction and try saving it in the Controller

alos use wdevent->get_cotnext_element( 'CONTEXT_ELEMENT' )

which return the current selected element

Abhi

former_member187651
Active Participant
0 Kudos

hello Abhi,

How could I get the current selected attribute value with the above defined method.

Please let me explain.

thanks.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

There is Event for Click onAction Tree Item

In that Event Use the code to get the ID and path

  • get the id of the ui element at which the user has clicked

id = wdevent->get_string( 'ID' ).

  • get the path within the context that marks the node at which the user has clicked

path = wdevent->get_string( 'PATH' ).

Abhi

former_member187651
Active Participant
0 Kudos

Hello Abhi,

I am using Recusive context node in my table tree. I need to read the node value with Onclick event.

But each time I am getting parent node value.,

When I debug the same, I found ID is giving Node name. And value of node is not changing when I click children ,I always give parent node value.

Please let me know the solution................

Thanks...........