on 12-23-2009 9:41 AM
Hi Experts,
I have a requirement in my proj in which I have to search a perticular element in the tree.
I have created a tree structure and there is an input field on the screen as well. Now when I enter any value in the input field and clink on search button, that value (if present in the tree) should get lead selected. If the node is not expanded and a value is searched, the tree should expand and that value should be highlighted. Can we achieve this functionality?? If yes, then please guide me.
Thanks
Arjun
Hello Arjun,
You could always do it.
Once you get the text in the input field, you could read the context which is maintained for the tree node which would maintain the text, parent id, state etc, so the tree node state(expanded/collapsed) is also maintained as a boolean value whether it is expanded or not, which you can fill explicitly. so you just have to fill the context data correctly. and once done, you could explicitly set the focus on the node as well.
Regards
Anurag Chopra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anurag,
Thanks for your reply.
In the ONACTIONLOADCHILD method of the tree I use the following code to get the ref of the node that has been expanded.
data: lr_element type ref to if_wd_context_element.
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
But if I click on serach button, how would I get the ref of node which should be expanded?
Regards
Arjun
Hi Arjun,
You need to fill the context node by the supply function if you expect one to search the the tree by the input field as one can select the tree's element at any level.
So as soon one enters the text (tree element which could be a node or a children ), you need to search the internal table and identify at what level the element belongs to and then you just need to change the boolean value of the expand property.
You can get the reference of the node by first accessing the root node and then for the tree node by passing the name of the node.
Regards
Anurag Chopra
Edited by: Anurag Chopra on Dec 23, 2009 7:21 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.