You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Reid, Jeff (Liquidity & Risk Technology)" <Je...@ml.com> on 2006/05/18 19:45:35 UTC

t:columns and iterating through row objects that contain list of column objects.

Hi,

I'm using myfaces 1.1.1

Using a <t:datatable> and <t:columns>, I'd like to iterate through row
objects that contain list of column objects.  The <t:columns> docs say:

<t:datatable value="#{rows}" var="row">
  <t:columns value="#{cols}" var="col">
    <f:facet name="header" value="#{col.name}"/>
    <h:outputText value="#{row.colValue}"/>
  </t:columns>
</t:datatable> 

But what I'd like to do is:

<t:datatable value="#{rows}" var="row">
  <t:columns value="#{row.cols}" var="col">
    <f:facet name="header" value="#{col.name}"/>
    <h:outputText value="#{col.value}"/>
  </t:columns>
</t:datatable> 

This doesn't seem to work.  Would this work in the latest version of
myfaces?  Am I doing something wrong?

I searched the archives, and found something related, but this seems
pretty involved for what I thought we be something straightforward.

http://marc2.theaimsgroup.com/?l=myfaces-user&m=114419934911732&w=2
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------

Re: t:columns and iterating through row objects that contain list of column objects.

Posted by Mike Kienenberger <mk...@gmail.com>.
On 5/18/06, Reid, Jeff (Liquidity & Risk Technology) <Je...@ml.com> wrote:

> Using a <t:datatable> and <t:columns>, I'd like to iterate through row
> objects that contain list of column objects.
> But what I'd like to do is:
>
> <t:datatable value="#{rows}" var="row">
>   <t:columns value="#{row.cols}" var="col">
>     <f:facet name="header" value="#{col.name}"/>
>     <h:outputText value="#{col.value}"/>
>   </t:columns>
> </t:datatable>
>
> This doesn't seem to work.  Would this work in the latest version of
> myfaces?  Am I doing something wrong?

I don't think t:columns has significantly changed since 1.1.1.

I also don't see any problems with what you proposed.  It should work
if you have a list of column objects as part of each and every row
object.

> I searched the archives, and found something related, but this seems pretty
> involved for what I thought we be something straightforward.
>
> http://marc2.theaimsgroup.com/?l=myfaces-user&m=114419934911732&w=2

No, this is different.   This is a list of row objects, an independent
list of column objects, and a data model that represents the
intersection between the two.

In this model, there are n rows and m column objects.   In your model,
there are n rows, and nxm column objects.