myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <>
Subject embedded table
Date Thu, 24 Jan 2008 06:14:44 GMT

One thing in JSF which constantly worries me is, that it is not easily 
possible to create a more complicated table layout with 
group/group/detail style.

What I mean is somthing like this:

Name Column1 Column2
Name1 10 20
Name2 20 30
Name3 40 50
Name5 60 70

This reflects a list in a list in a list.

Currently, with JSF there is no chance to nest tables in such a way 
without rendering completely unrelated tables. The problem is, that the 
sub tables then have their own column width and it is hard to make them 
look as just one table.

I thought about a new attribute on the dataTable (embedded="true") which 
avoids rendering the <table></table> attributes so that the rendered 
table nicely nest into the parent table.
For sure, the user has to take care that the numer of columns are the 
same among all tables, probably by using stuff like "t:column colspan=".

Secondly, to make this fully usable, we need another way to define the 
header of a table as the "master" table has to render a very special 
header where one would like to mix in the header of the detail row.
For this, I thought we could use a facet directly on the datatable. In 
the end, it might look like the following:

<t:datable var="group1" value="#{}">
    <f:facet name="columnHeader1">
        <t:column colspan="2">
            <t:outputText value="header" />
    <f:facet name="columnHeader2">
            <t:outputText value="detailA" />
    <f:facet name="columnHeader3">
            <t:outputText value="detailB" />
    <t:column colspan="10">
        <t:outputText value="#{group1.headerValue}" />
    </t:datable var="group2" value="#{group1.groupData}" embedded="true">
        <t:column colspan="2">
            <t:outputText value="#{group2.headerValue2}" />
        <t:column colspan="8">
            <t:outputText value="#{group2.headerValue2}" />
        </t:datable var="detail" value="#{group2.detailData}" 
                <t:outputText value="#{detail.value1}" />
                <t:outputText value="#{detail.value10}" />

I know, with facelets I can achive the same using plain html tags and 
dataLists, but I STRONGLY prefer NOT to use such an approach, I'd like 
to use ONLY components.

What do you think?


View raw message