You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Dipl.-Ing. Torsten Liermann" <li...@liermann-it.de> on 2007/08/06 10:07:44 UTC

h:dataTable Beginner's question

Hi,

A Beginner's question to h:dataTable

I have a table for each row another
Combo box must be generated. The contents surrender from the current row object

Unfortunately, the expression Language does not support the following syntax:

<h:selectOneMenu styleClass="blue" value="currentVersion">
  <f:selectItems value="#{backedBean.version(rowObject}"/>
</h:selectOneMenu>


Is there a callback into the backing bean which is called for each row?
Or how is the recommended way without touch the domain object?

Thanks
Torsten

Re: h:dataTable Beginner's question

Posted by Cagatay Civici <ca...@gmail.com>.
Hi,

Tomahawk's selectItems may help.

<h:selectOneMenu styleClass="blue" value="currentVersion">
 <t:selectItems value="#{rowObject.items}" var="item" itemLabel="#{
item.label}" itemValue="#{item.value}"/>
</h:selectOneMenu>

Regards,

Cagatay

On 8/6/07, David Delbecq <de...@oma.be> wrote:
>
> First alternative, using component binding (note: your backedbean must
> be session scoped):
> <h:dataTable binding="#{backedBean.component} value="..."  ... >
>
>     ....
>        <h:selectOneMenu styleClass="blue" value="currentVersion">
>             <f:selectItems value="#{backedBean.version}"/>
>        </h:selectOneMenu>
>     ....
> </h:dataTable>
>
> In you backed bean:
>
> public void setComponent(UIComponent component) {...}
> public UIComponent getComponent() {...}
> public SelectItem[] getVersion() {
>     ...
>     int row = ((UIData)getComponent()).getRowIndex();
>     ...
> }
>
> Second alternative (prefered), do a separate selectItems construction in
> each bean of collection:
> <h:dataTable value="#{backedBean.items}" var="item" >
>
>     ....
>        <h:selectOneMenu styleClass="blue" value="#{item.currentVersion}">
>             <f:selectItems value="#{item.availableVersions}"/>
>        </h:selectOneMenu>
>     ....
> </h:dataTable>
> En l'instant précis du 06/08/07 10:07, Dipl.-Ing. Torsten Liermann
> s'exprimait en ces termes:
> > Hi,
> >
> > A Beginner's question to h:dataTable
> >
> > I have a table for each row another
> > Combo box must be generated. The contents surrender from the current row
> object
> >
> > Unfortunately, the expression Language does not support the following
> syntax:
> >
> > <h:selectOneMenu styleClass="blue" value="currentVersion">
> >   <f:selectItems value="#{backedBean.version(rowObject}"/>
> > </h:selectOneMenu>
> >
> >
> > Is there a callback into the backing bean which is called for each row?
> > Or how is the recommended way without touch the domain object?
> >
> > Thanks
> > Torsten
> >
>
>
> --
> http://www.noooxml.org/
>
>

Re: h:dataTable Beginner's question

Posted by David Delbecq <de...@oma.be>.
First alternative, using component binding (note: your backedbean must
be session scoped):
<h:dataTable binding="#{backedBean.component} value="..."  ... >

    ....
       <h:selectOneMenu styleClass="blue" value="currentVersion">
            <f:selectItems value="#{backedBean.version}"/>
       </h:selectOneMenu> 
    ....
</h:dataTable>

In you backed bean:

public void setComponent(UIComponent component) {...}
public UIComponent getComponent() {...}
public SelectItem[] getVersion() {
    ...
    int row = ((UIData)getComponent()).getRowIndex();
    ...
}

Second alternative (prefered), do a separate selectItems construction in
each bean of collection:
<h:dataTable value="#{backedBean.items}" var="item" >

    ....
       <h:selectOneMenu styleClass="blue" value="#{item.currentVersion}">
            <f:selectItems value="#{item.availableVersions}"/>
       </h:selectOneMenu> 
    ....
</h:dataTable>
En l'instant précis du 06/08/07 10:07, Dipl.-Ing. Torsten Liermann
s'exprimait en ces termes:
> Hi,
>
> A Beginner's question to h:dataTable
>
> I have a table for each row another
> Combo box must be generated. The contents surrender from the current row object
>
> Unfortunately, the expression Language does not support the following syntax:
>
> <h:selectOneMenu styleClass="blue" value="currentVersion">
>   <f:selectItems value="#{backedBean.version(rowObject}"/>
> </h:selectOneMenu>
>
>
> Is there a callback into the backing bean which is called for each row?
> Or how is the recommended way without touch the domain object?
>
> Thanks
> Torsten
>   


-- 
http://www.noooxml.org/