Hello to everybody and thanks in advanced.
I have the following problem.
I have to create a tree that handles the event onclick on a node. The application is implemented in htmlb. Moreover htmlb has such standard elements like TREE and TREENODE that let me handle this event.
My problem is that I need to handle a lot of different trees and they are going to be changed each few time.
By using a table with the type TVIEW2 or TVIEW it would be pretty easy to administrate the trees.
So I have that my trees are in a table tab with type TVIEW2.
The following line would display the tree.
<htmlb:tree id="myTree4" table2="<%=tab%>"/>
This looks easy.
The problem is that in that case I have not clue about how to handle the event onclick in a node and I do not use the standard TREENODE.
I have thought about building up the tree looping at the table and using TREENODE. Something like this.
<htmlb:tree id = "reportTree"
title = "Listado de Reportes"
tooltip = "Seleccione un reporte de la lista">
<%LOOP AT tabla INTO wa_tablatree.
<htmlb:treeNode
id = "<%= wa_tablatree-childid %>"
text = "<%= wa_tablatree-text %>"
isOpen = "<%= isopen %>"
tooltip = "<%= wa_tablatree-tooltip %>"
link = "<%= wa_tablatree-link %>"
target = "<%= wa_tablatree-tooltip %>"
image = "<%= wa_tablatree-img %>"
onNodeClick = "onnodeclick"/>
<%ENDLOOP.%>
</htmlb:tree>
Here I can handle the event but the tree is plane, it does not have a tree looks like.
Does Anyone know a way to handle onclick events on a tree node and at the same time to be able to build up the tree from a table?.
Thanks again
Hi Oscar,
expand your <HTMLB:tree...> with onTreeClick = "X".
The OnInputProcessing like the following:
data event type ref to if_htmlb_data. if event_id = cl_htmlb_manager=>event_id. event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ). event = CL_HTMLB_MANAGER=>get_event_ex( request ). case event->event_name. when 'tree'. if event->id eq 'reportTree'. if event->server_event eq 'onnodeclick' or event->server_event eq 'ONNODECLICK' or event->server_event eq 'nodeClick'. -> Here is your code endif. endif. endcase. endif.
Hope i could give you first step to your goal.
Thorsten
You need to look at the application SBSPEXT_HTMLB in transaction SE80 and see the treenode example.
How to handle the onclick is quite easy and stated very clearly there.
When you click on something the OnInputProcessing or DO_HANDLE_REQUEST (MVC) fires and you can therefore access all items in the request.
Either you use TVIEW or TIVEW2 there is a field called <b>CLICK</b> you can fill this with the event name. (e.g mynodeclick')
if you have this property filled in , after the tree is rendered you can click on the node which will generate server event which you can capture oninputprocessing.
DATA: event TYPE REF TO if_htmlb_data . DATA: tree_event TYPE REF TO cl_htmlb_event_tree. event = cl_htmlb_manager=>get_event( request ). if event->event_name = htmlb_events=>tree. CLEAR : tree_event . tree_event ?= event. MOVE: tree_event->node . " This is the current node clicked endif .
Also check out the following weblog .
/people/durairaj.athavanraja/blog/2004/11/21/bsphow-to-build-performance-efficient-dynamic-htmlbtree
Regards
Raja
Add a comment