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

width of htmlb tree

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2005 at 07:25 AM

    -> 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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2005 at 01:55 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2005 at 07:53 PM

    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?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 08:53 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

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.