cancel
Showing results for 
Search instead for 
Did you mean: 

htmlb:tree differentiate between nodeclick and tree node expander click

Former Member
0 Kudos

Hi,

how can i differentiate between nodeclick and tree node expander (to get to its children) click in my event processing in htmlb:tree element.

<u><b>What i am trying to achieve?</b></u>

Onload just load root node and its immediate children.

On node expand get the children of the current node and modify htmlb:tree table2 with additional node inofs.

on node click call some client function.

But my issue is that i am not able to differentiate between node expander click and node click in my event handling. Any help on this is appreciated.

(I am not using MVC)

Thanks in advance.

Regards

Raja

Message was edited by: Durairaj Athavan Raja

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

May I ask why you just don't build the tree completely and let the BSP handle what is open and what not?

Otherwise you'll have to check which node is clicked and if it is a main node then you would have to do your build and if not then it would just expand. A lot of extra logic involved there.

athavanraja
Active Contributor
0 Kudos

Thanks Craig.

I am building a tree which at times depending on user will have about 2500 nodes and (spanning around 6 levels) and about 5000 items. If had to build the whole tree at once it would take a lot time.

<u><b>Just figured out how to solve my problem.</b></u>

if the status field(of tview table) is properly maintained (<b>open/closed/final</b>) then when i click the node expander oninputprocessing <b>CL_HTMLB_EVENT_TREE->status</b> gives me the current status. for e.g if the node is closed and i have clicked to expand it the <b>event_tree->status</b> returns "<b>C</b>" and "<b>O</b>" if i am trying to close a opened node.

If i click on the node itself (not the expander) <b>event_tree->status </b> is delievered <b>empty</b>.

Now with this i can achieve what i was trying to do.

Anyhow thanks for your response.

Regards

Raja

Former Member
0 Kudos

A lot of extra processing but makes sense for such a large tree node.

A weblog on this whole process - you know step by step would be great reading!!!

Hope you write one up!

athavanraja
Active Contributor
0 Kudos

Yeah lot of extra processing.

Yes i will write a weblog on this as this solution i am developing is quiet intersting which is going to be delivered via portal and within my bsp i am using EPCMproxy to communicate between pages as some pages are going to be in dynamic navigation area of portal page and some in detail naviagation.

Regards

Raja

Former Member
0 Kudos

Sounds very interesting, however, the treenode building and processing alone would be a weblog in itself.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm curious if you have tried buiding the entire tree at once. I have a similiar BSP (10 levels deep 5000+ items) and I thought that I would have performance problems. However suprisingly I don't. Retrieving the data from R/3 and processing it into my node table takes about 1-2 seconds. My application is stateful, so I only do this processing once. I'm curious what kinds of performance you had seen, if you tried building the entire tree at once. The only difference there might be is that my data is pre-aggrigated and grouped on the R/3 side by nightly batch jobs.

athavanraja
Active Contributor
0 Kudos

Hi,

I wa using BAPI_COSTCENTERGROUP_GETDETAIL to get the cost center group details to build the tree and it was taking time both at the time of getting the data and also rendering the htmlb:tree.

Moreover the documentation for htmlb:tree says

<i>The tree element is not intended for displaying tree structures with

thousands of nodes and end nodes. In general, a tree should never

contain more than 30 to 50 entries. Ensure that the size of your

HTML page grows in proportion to the number of entries. </i>

Now i am using G_SET_FETCH to get the immediate children.

I havent completed the coding for this scenario. Once i complete the same i would be able to compare the timings and let you know.

Regards

Raja

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

After reading your weblog I think I understand better. I did some testing with my example. I am using the toggle = "true", so that the page returns to the server each time an expander is selected.


<htmlb:tree id          = "myTree1"
              height      = "75%"
              toggle      = "true"
              title       = "<b><otr>EQI Reporting Tree</otr></b>"
              width       = "90%"
              onTreeClick = "myTreeClick"
              table       = "<%= application->selection_model->itview                             %>" >
  </htmlb:tree>

However I have not added any coding in my event handler to respond to the expander event. I only respond to myTreeClick (which loads some data for the given selection). The BSP tree element itself must be doing the hard work for me.


  if event_id cs 'tr_myTree1'.

    data: tree_event type ref to cl_htmlb_event_tree.
    tree_event ?= htmlb_event.
    if tree_event->server_event = 'myTreeClick'.
      clear appl->message1.
      appl->selection_model->get_chart_data( appl = appl
                                             node = tree_event->node ).
    endif.
  endif.

I pass my entire tree defintion to the element. It appears that it only sends visible nodes to be rendered. When the expander is selected, I don't have to do anything, the tree re-renders with only the newly visible rows.

I tested and turned off the toggle (toggle = "false") and my page took forever to load because it was sending all the nodes to the frontend on the first load.

athavanraja
Active Contributor
0 Kudos

Hi Thomas,

Thanks for sharing your observations. I have also tried this method, It only solves the problem of improving the perfomance in rendering the tree. But if your ABAP is taking lot of time to fetch the values then we have to follow the model in my weblog, else (ABAP dosent really take mauch time to fetch data for the full tree) then your model is much simpler and elegant to handle.

With your permission can i add your approach also to the weblog.

Regards

Raja

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

No problem.