Skip to Content
author's profile photo Former Member
Former Member

to handle onclick events on a tree node built from a table in htmlb

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 15, 2005 at 12:46 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 15, 2005 at 12:37 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 15, 2005 at 12:38 PM

    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
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks I Have had a look into your weblog and even though it was not exactly what I was looking for It was very interesting and it helped me with my program.

      Your note is very usufull too.

      Finally I have used the note posted by Thorsten.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.