Hi Tony,
It's probably best to keep this on the myfaces mailing lists because
I'm not always around and, more importantly, I'm not always right :)
Actually, t:columns effectively is a dataTable with
layout=lineDirection. It's just a UIData subclass with a custom
renderer that outputs <td> tags instead of <tr> tags.
Any of the methods and attributes for dataTable work for columns. In
fact, you have to mentally-convert "column' to "row" when you use it,
because columns refers to its columns as rows. Ie,
Columns.getRowData() really means Columns.getColumnData()
It's unclear to me why you're using a facet rather than just add
columns to the t:columns children.
On 11/23/05, Tony Czupryna <[EMAIL PROTECTED]> wrote:
> Thanks Mike. This *works* although it is quite the hack. Also, <t:radio>
> does not work in here either because I can't get a column index var on
> <t:columns>. I arranged this vertically first and tried <t:selectOneRadio>
> spread and <t:radio> couldn't find the compontent.
>
> Do you think it would make sense to have
> dataTable.layout={pageDirection|lineDirection} or some such
> available so that dataTables could reverse their rows/columns? That would
> have made this trivial. A jsf foreach would have made it trivial as well.
>
> <t:dataTable id="data" var="row" value="#{base.emptyList}"
> preserveDataModel="false" renderedIfEmpty="true">
> <t:columns value="#{base.values}" var="col">
> <f:facet name="header">
> <h:panelGrid columns="2">
> <t:selectOneRadio id="radio" forceId="true"
> forceIdIndex="false" value="#{base.radioKey}">
> <f:selectItem itemValue="#{col.key}" itemLabel=" "/>
> </t:selectOneRadio>
> <h:panelGroup>
> <h:panelGrid columns="1">
> <h:panelGroup>
> <h:outputText value="#{base.line1}"/>
> <h:outputText value=" "/>
> <h:outputText value="#{base.line2}"/>
> </h:panelGroup>
> <h:outputText value="#{col.description1}"/>
> <h:outputText value="#{col.description2}"/>
> </h:panelGrid>
> </h:panelGroup>
> </h:panelGrid>
> </f:facet>
> </t:columns>
> </t:dataTable>
>
> Thanks again for you help,
>
> Tony
>
> On 11/23/05, Mike Kienenberger <[EMAIL PROTECTED]> wrote:
> > Maybe what you need is a h:dataTable with a t:columns (with an "s")
> component.
> >
> > <h:dataTable>
> > <t:columns>
> > <h:column>
> > <radio button>
> > <some text>
> > <more text>
> > </h:column>
> > </t:columns>
> > </h:dataTable>
> >
> > You'd just initialize your dataTable with a constant "one-row" backing
> model.
> > And you'd use t:columns as if it were a dataTable, except that it'll
> > display items horizontally rather than vertically.
> >
> > On 11/23/05, Tony Czupryna <[EMAIL PROTECTED]> wrote:
> > > As far as I can tell from reading and testing, jstl foreach does not
> work
> > > with jsf. I will continue to poke at it. Basically I'm trying to set up
> a
> > > set of complex radio buttons across a page (I hope this looks right):
> > >
> > > Radio1 SomeText Radio2 SomeText Radio3
> SomeText
> > > MoreText MoreText
> MoreText
> > >
> > > Thank you for spanning time on this,
> > > Tony
> > >
> > >
> > > On 11/23/05, Mike Kienenberger <[EMAIL PROTECTED] > wrote:
> > > > dataList is an iterating tag. But it's going to iterate at render
> > > > time and output html. c:forEach is an iterating jsp tag that
> > > > iterates at component tree building time and can "output" components,
> > > > at least when used with facelets (not sure how it works with the
> > > > standard JSF JSP view handler.)
> > > >
> > > > Is there a reason why you can't use dataTable? The simple example
> > > > you posted would work with dataTable, but maybe your actual
> > > > requirements are more complicated.
> > > >
> > > > On 11/23/05, Tony Czupryna < [EMAIL PROTECTED] > wrote:
> > > > > Apologies. I thought the bug yesterday was not opened because JIRA
> timed
> > > out
> > > > > as it was posting. I noticed the email this morning after creating
> this
> > > > > enhancement request. I also realized this morning before requesting
> this
> > > > > enhancement that this was working as intended. Since dataList is a
> > > component
> > > > > it goes into one column of panelGrid. I have attempted to use
> c:foreach
> > > with
> > > > > no success. I will see if I can find some relevant threads or get
> help
> > > on
> > > > > the users list. What I need is an iterating tag that renders its
> > > children
> > > > > only.
> > > > >
> > > > > Sorry again for the repost.
> > > > >
> > > > > -Tony
> > > > >
> > > > >
> > > > >
> > > > > On 11/23/05, Mike Kienenberger (JIRA) <[email protected]>
> wrote:
> > > > > > [
> > > > >
> > >
> http://issues.apache.org/jira/browse/MYFACES-868?page=comments#action_12358391
> > > > > ]
> > > > > >
> > > > > > Mike Kienenberger commented on MYFACES-868:
> > > > > > -------------------------------------------
> > > > > >
> > > > > > Tony,
> > > > > >
> > > > > > As Simon remarked the first time you opened this issue, you should
> > > discuss
> > > > > this on the MyFaces user list.
> > > > > >
> > > > > > JSF works on components, not on rendered html.
> > > > > >
> > > > > > The panelGrid component takes a list of components and puts each
> one
> > > in a
> > > > > separate column.
> > > > > >
> > > > > > However, the dataList component is a single component to the
> parent
> > > > > panelGrid, despite all of the html that's being rendering, so all of
> > > that
> > > > > html is going to be put into the same column.
> > > > > >
> > > > > > One thing you could try is to use the jsp c:forEach tag instead of
> > > > > dataTable. This will create multiple copies of each component as
> the
> > > > > component tree is built. I've never used forEach, but others have
> > > brought
> > > > > it up on the facelets mailing list. The dataList component (and all
> JSF
> > > > > components) only render output from components at render time, but
> they
> > > do
> > > > > not add multiple copies of components at component tree build time.
> > > > > >
> > > > > > Put another way: The first time a page is displayed, a component
> > > tree is
> > > > > built. That's what panelGrid is going to work on. Each time the
> page
> > > is
> > > > > displayed, the html is going to be rendered, and that's what
> dataList is
> > > > > going to work on.
> > > > > >
> > > > > > If it were me, I would not be trying to solve the problem this
> way.
> > > > > >
> > > > > > I'd either replace panelGrid + dataList with a dataTable (that's
> what
> > > a
> > > > > datatable is!) or I'd get rid of the panelGrid and directly render
> the
> > > html
> > > > > table tags using f:verbatim tags. dataList excels at letting you
> > > provide
> > > > > the formatting while it provides the iteration.
> > > > > >
> > > > > > This issue needs to be marked "Won't Fix" and closed.
> > > > > >
> > > > > > > dataList treatment inside panelGrid
> > > > > > > -----------------------------------
> > > > > > >
> > > > > > > Key: MYFACES-868
> > > > > > > URL:
> > > > > http://issues.apache.org/jira/browse/MYFACES-868
> > > > > > > Project: MyFaces
> > > > > > > Type: Improvement
> > > > > > > Components: Tomahawk
> > > > > > > Versions: 1.1.1, Nightly
> > > > > > > Environment: 11/22/2005 Nightly Build
> > > > > > > Tomcat 5.5
> > > > > > > Fedora 4
> > > > > > > Reporter: Tony Czupryna
> > > > > > > Priority: Minor
> > > > > >
> > > > > > >
> > > > > > > I'm basically trying to use a dataList as a foreach to display a
> > > bunch
> > > > > of panelGroups across the screen. When the page renders, the
> dataList is
> > > > > treated as a single panelGroup and displays vertically instead of
> > > > > horizontally. It would be great if I could tell the dataList to
> > > basically be
> > > > > ignored by panelGrid and just render what it contains. This makes it
> > > > > possible to use dataList as a foreach. Maybe this should be a new
> tag
> > > that
> > > > > extends dataList. A test jsp:
> > > > > > > <%@ page session="true"
> > > > > contentType="text/html;charset=UTF-8"
> language="java"
> > > %>
> > > > > > > <%@ taglib uri=" http://java.sun.com/jsf/html" prefix="h" %>
> > > > > > > <%@ taglib uri=" http://java.sun.com/jsf/core" prefix="f" %>
> > > > > > > <%@ taglib uri="
> > > http://myfaces.apache.org/tomahawk"
> > > > > prefix="t" %>
> > > > > > > <html>
> > > > > > > <head><title>TonyTesterNoGrid</title></head>
> > > > > > > <body>
> > > > > > > <f:view>
> > > > > > > <h:panelGrid columns="#{tonyTester.numberOfHelpers}">
> > > > > > > <t:dataList id="test" var="helper" value="#{
> tonyTester.helpers
> > > }">
> > > > > > > <h:panelGroup>
> > > > > > > <h:panelGrid columns="1">
> > > > > > > <h:outputText value="#{ helper.key}"/>
> > > > > > > <h:outputText value="#{helper.descriptionLine1 }"/>
> > > > > > > <h:outputText value="#{helper.descriptionLine2}"/>
> > > > > > > </h:panelGrid>
> > > > > > > </h:panelGroup>
> > > > > > > </t:dataList>
> > > > > > > </h:panelGrid>
> > > > > > > </f:view>
> > > > > > > </body>
> > > > > > > </html>
> > > > > > > Currently, the entire list is put into the first column of the
> > > > > panelGrid:
> > > > > > > <html>
> > > > > > > <head><title>TonyTesterNoGrid</title></head>
> > > > > > > <body>
> > > > > > > <table border="0"><tbody><tr><td>
> > > > > > > <table border="0"><tbody><tr><td>1</td></tr>
> > > > > > > <tr><td>helper1-descriptionLine1</td></tr>
> > > > > > > <tr><td>helper1-descriptionLine2</td></tr>
> > > > > > > </tbody></table>
> > > > > > > <table border="0"><tbody><tr><td>1</td></tr>
> > > > > > > <tr><td>helper2-descriptionLine1</td></tr>
> > > > > > > <tr><td>helper2-descriptionLine2</td></tr>
> > > > > > > </tbody></table>
> > > > > > > <table border="0"><tbody><tr><td>1</td></tr>
> > > > > > > <tr><td>helper3-descriptionLine1</td></tr>
> > > > > > > <tr><td>helper3-descriptionLine2</td></tr>
> > > > > > > </tbody></table>
> > > > > > > </td><td></td><td></td></tr>
> > > > > > > </tbody></table>
> > > > > > > </body>
> > > > > > > </html>
> > > > > > > I'd like to be able to render with each contained panelGroup as
> a
> > > > > separate column in the panelGrid:
> > > > > > > <html>
> > > > > > > <head><title>TonyTesterNoGrid</title></head>
> > > > > > > <body>
> > > > > > > <table border="0"><tbody><tr><td>
> > > > > > > <table border="0"><tbody><tr><td>1</td></tr>
> > > > > > > <tr><td>helper1-descriptionLine1</td></tr>
> > > > > > > <tr><td>helper1-descriptionLine2</td></tr>
> > > > > > > </tbody></table>
> > > > > > > </td><td>
> > > > > > > <table border="0"><tbody><tr><td>1</td></tr>
> > > > > > > <tr><td>helper2-descriptionLine1</td></tr>
> > > > > > > <tr><td>helper2-descriptionLine2</td></tr>
> > > > > > > </tbody></table>
> > > > > > > </td><td>
> > > > > > > <table border="0"><tbody><tr><td>1</td></tr>
> > > > > > > <tr><td>helper3-descriptionLine1</td></tr>
> > > > > > > <tr><td>helper3-descriptionLine2</td></tr>
> > > > > > > </tbody></table>
> > > > > > > </td></tr>
> > > > > > > </tbody></table>
> > > > > > > </body>
> > > > > > > </html>
> > > > > > > It would also have to be able to render additional rows
> properly.
> > > > > >
> > > > > > --
> > > > > > This message is automatically generated by JIRA.
> > > > > > -
> > > > > > If you think it was sent incorrectly contact one of the
> > > administrators:
> > > > > >
> > > > >
> > >
> http://issues.apache.org/jira/secure/Administrators.jspa
> > > > > > -
> > > > > > For more information on JIRA, see:
> > > > > > http://www.atlassian.com/software/jira
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>