myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Winer" <awi...@gmail.com>
Subject Re: [Trinidad] Inner table with dynamic columns
Date Fri, 18 May 2007 21:17:32 GMT
On 5/18/07, Francisco Passos <francisco.passos@gmail.com> wrote:
> Hello there.
>
> I'm trying to make a <tr:table> with two columns (name, value). The number
> of lines is variable and I'd like to use tr:table to be able to use
> pagination later, since it will probably be necessary.
>
> So far everything's going fine.
>
> Now, on the value column, I want to place another <tr:table>. And to make it
> a little harder, I need it to have a variable number of columns and lines.

This is, in essence, not possible.

When you have a table inside a table, there's only *one*
instance of that inner table.  So the only way to have a different
number of columns is by having a fixed set and using "rendered"
to turn them on and off.  It's impossible for one inner table
to have 3 columns and another inner table have 5 columns,
because there's only *one* inner table.

-- Adam


>
> For the inner table, I'm trying to do something like this
>
> <tr:table>
> <c:forEach ...>
> <tr:column>
> ...
> </tr:column>
> </c:forEach>
> </tr:table>
>
> The problem is this inner list shows no content - only an empty box. The
> logs start by saying
>
> 18/Mai/2007 18:57:25
> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TableRenderer
> renderTableWithoutColumns
> WARNING: Table with id: mainForm:_id89:1:_id96 has no visible columns!
>
> and then move on to lots of things like this:
>
> 18/Mai/2007 18:57:25
> org.apache.myfaces.trinidadinternal.io.HtmlResponseWriter
> endElement
> SEVERE: Element End name:td does not match start name:div
>
>
> I believe the problem might have to do with the fact that the list the
> c:forEach is iterating on is created as a variable by the outer tr:table.
> Could that be it?
>
> I'm attaching the code for you to see. By the way, I'm using JSF 1.1,
> Trinidad 1.0.0-incubating, Tomahawk 1.1.5 and Facelets 1.1.11.
>
>
>
>
>
> ---- CODE BE HERE ----
>
> <tr:table value="#{ fichaBean.attributes}" var="attribute" rendered="#{not
> empty fichaBean.attributes}" styleClass="stptable" inlineStyle="width:
> default;">
>         <tr:column>
>             <tr:outputText value="#{ attribute.xnomatrb}"/>
>         </tr:column>
>         <tr:column>
>             <tr:table value="#{attribute.attributeData}" var="attributeData"
> rendered="#{attribute.xtipdado eq 'S' or attribute.xtipdado eq 'L'}"
> rows="0">
>                 <tr:column headerText="#{attributeData.inomcol}">
>                     <tr:outputText value="#{ attributeData.xvalor}" />
>                 </tr:column>
>             </tr:table>
>
>             <tr:table value="#{attribute.tableAttributeData}"
> var="lineAttributeData" rendered="#{ attribute.xtipdado eq 'T'}"
> inlineStyle="border: 1px;">
>                 <c:forEach items="#{lineAttributeData}" var="attribData">
>                     <tr:column headerText="#{ attribData.inomcol}">
>                         <tr:outputText value="#{attribData.xvalor}" />
>                     </tr:column>
>                 </c:forEach>
>             </tr:table>
>         </tr:column>
>     </tr:table>
>

Mime
View raw message