I just got the table to render real columns. I copied the code from one
of the other renderers.

Below is the jsp. The dummy x:treeColumn is just used to mark the
position of the tree column. Columns before this dummy component  will
be rendered by the beforeEncodeNode, and columns after this dummy
component will be rendered in the afterEncodeNode.  The tree facets can
be placed anywhere since they don't get counted as component children,
but ideally they would look better inside "treeColumn" (or whatever the
appropriate name should be).

Btw, this is a server-side toggle tree. 

I don't have the rendering of the headers yet. There's gotta be
somewhere else I can copy that code.

I don't think we should give up on the clien-side javascript. I don't
really know javascript that much but I think what we need is doable.
What we need for the client-side javascript is a lookup for all row
elements that are children of a specific spanId.  The current javascript
looks like this:

...
    var navSpan = document.getElementById(spanId);
    var displayStyle = navSpan.style.display;
    if (displayStyle == 'none') {
        displayStyle = 'block';
        CookieLib.setCookieAttrib(cookieName, nodeId, "x");
    } else {
        displayStyle = 'none';
        CookieLib.setCookieAttrib(cookieName, nodeId, "c");
    }
 ...

What we need is something like this (I'm reusing "spanId" even though
we're really applying it on TR elements and not SPAN elements). 
  var tr
  while ((tr = document.getElementThatStartsWithId(spanId)) != null) {
    if (displayStyle == 'none') {
        displayStyle = 'block';
        displayStyle = 'table-row'
        CookieLib.setCookieAttrib(cookieName, nodeId, "x");
    } else {
        displayStyle = 'none';
        CookieLib.setCookieAttrib(cookieName, nodeId, "c");
    }   
  }





The jsp
-------------------
 <my:tree2Table value="#{taskListHandler.treeData}" id="server-tree"
var="node" varNodeToggler="t" clientSideToggle="false">
        <h:column>
                <h:commandLink
actionListener="#{taskListHandler.editTask}" immediate="true">
                        <h:outputText value="[edit]"/>
                </h:commandLink>
        </h:column>
        <x:treeColumn>
        </x:treeColumn>
        <f:facet name="group">
          <h:panelGroup>
                <h:commandLink immediate="true"
action="#{t.toggleExpanded}">
                  <h:graphicImage value="/images/yellow-folder-open.png"
rendered="#{t.nodeExpanded}" border="0"/>
                  <h:graphicImage
value="/images/yellow-folder-closed.png" rendered="#{!t.nodeExpanded}"
border="0"/>
                </h:commandLink>
                <h:outputText value="#{node.description}"
styleClass="nodeFolder"/>
          </h:panelGroup>
        </f:facet>
        <f:facet name="task">
          <h:panelGroup>
                <h:commandLink immediate="true" styleClass="document">
                  <h:graphicImage value="images/document.png"
border="0"/>
                  <h:outputText value="#{node.description}"/>
                  <f:param name="docNum" value="#{node.identifier}"/>
                </h:commandLink>
          </h:panelGroup>
        </f:facet>
        <h:column>
                <f:facet name="header">
                        <h:panelGroup>
                                <h:commandLink
action="#{taskListHandler.sortByGroup}" immediate="true">
                                        <h:outputText value="Group"/>
                                </h:commandLink>
                                <h:panelGroup
rendered="#{taskListHandler.sortBy == 1}">
                                        <h:graphicImage
value="/common/img/up.gif" rendered="#{taskListHandler.ascending}"/>
                                        <h:graphicImage
value="/common/img/down.gif" rendered="#{!taskListHandler.ascending}"/>
                                </h:panelGroup>
                        </h:panelGroup>
                </f:facet>
                <h:outputText value="#{node.groupName}"/>
        </h:column>


  </my:tree2Table> 

-----Original Message-----
From: Sean Schofield [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 10, 2005 1:01 PM
To: MyFaces Discussion
Subject: Fwd: Re: tree component & folder icon

---------- Forwarded message ----------
From: Sean Schofield <[EMAIL PROTECTED]>
Date: May 10, 2005 1:00 PM
Subject: Re: Re: tree component & folder icon
To: "Virtudazo, Dennis (Exchange)" <[EMAIL PROTECTED]>


> Anyway, I created tree2table renderer and tag. The main problem with 
> client-side collapse/expand is that html span doesn't work interspered

> among table rows. Hiding the rows themselves is possible but the 
> javascript has to hide/show each row individually (many rows versus 
> the current hiding on just a single span element). So a rewrite of the

> javascript for treeNavClick is needed.

I seemed to recall this being the major issue.

> I found that I actually needed to override the encodeTree method 
> because I need to modify the writing out of span elements.

I'll have to take a look at the existing code to refresh my memory and
see what you're talking about.

> The table columns btw, I'm thinking will have to be defined as 
> <column> tags within the tree2table. It is easy enough to cache the 
> column components so that they can be rendered for each node of the 
> tree. But I haven't made it work to render real columns yet, just
hardcoded columns.

This also sounds familiar.   Do you think treetable would be
manageable without the client-side javascript?  Would it be worth it to
implement without client-side support?  I'd be interested to see the
"ideal jsp" you would use to configure the treetable - regardless of
whether we give up on javascript or not.

Also, for those javascript-meisters out there ... feel free to look at
the problem Dennis is describing and see if there is an *elegant*
solution to our problem.

sean



***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

Reply via email to