cancel
Showing results for 
Search instead for 
Did you mean: 

width of htmlb tree

Former Member
0 Kudos

Hi All I have an htmlb tree control that shows the folders in the content management part of my SAP portal.

I create the tree in a Java bean using a recursive method to go through the folder structure

tree = new Tree("navTree");

tree.setOnTreeClick("treeClick");

this.setRoot(buildTree(request));

//buildTree is the recursive method, which appends child nodes

my jsp page then displays the tree like this

<%@ taglib uri="htmlb" prefix="hbj" %>

<%@page import="com.sapportals.htmlb.TreeNode"%>

<jsp:useBean id="navigationDataBean" scope="session" class="com.dfdstransport.portal.pub.externalweb.beans.NavigationDataBean" />

<table>

<tr>

<td align="left" valign="top" class="header1" style="background-image:url(img/dots-horizontal.gif); background-repeat:repeat-x; background-position:bottom;padding-bottom:3px"><%=navigationDataBean.getNavigationHeader()%></td>

</tr>

</table>

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId" >

<table>

<tr>

<td width ="100">

<%

myFormId.addComponent(navigationDataBean.getTree());

%>

</td>

</tr>

</table>

</hbj:form>

</hbj:page>

</hbj:content>

no problem so far the tree is shown with the correct nodes.

my problem is that I want to control the width of the Tree so it has a fixed width, so if some node has a very long name it will be wrapped within the tree control.

but the tree control does not seem to have any width attribute either in java api or in htmlb tags.

I have found some forum post and blogs where people use something like

<htmlb:Tree

id="foo"

node="fooNode"

..

..

width="100"

/>

I am running on EP6 SP9, could that be a problem.

any help or ideas on how to control the width would be greatly appreciated

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

What I did was to insert a Htmlb Gridlayout with a htmlb link object in each treenode, setting the width of the gridlayout will wrap the nodes.

I do not like this solution for severel reasons:

You lose a lot of the functionality and layout provided by the tree which was the reason I choose to use it.

On my project we decided that the Htmlb tree was simply not fit to our solution, so we decided to make our own tree ising standard <ul><li> html tags

Former Member
0 Kudos

so if you set the width of the table to 100px and one of the nodes has a name that is 200 px long will it wrap the text inside the tree?

Former Member
0 Kudos

sry Lund,Haven't tried that..u cud try and post the results back here..

Regards.

Former Member
0 Kudos

-> setting the width of the tree...

yes that is excactly what I want to do but the control does not have any property called width

I tried putting the htmlb tree inside an html table and setting the width of the td, but that did not have any effect.

If you say you have done it can you show me some code example

Former Member
0 Kudos

I tried something like this:

<table width="100%" border="0">

<tr><td>

<hbj:tree

id="myTree">

.......

..............

</hbj:tree>

</td></tr></table>

Itz working if i set it to any width..

Regards.

Former Member
0 Kudos

Hi Ulrik,

U cud try with html table tags and set the width of the tree.

It worked for me..

Let me know if u need more..

Regards.