You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yee CN <ye...@streamyx.com> on 2005/11/06 17:13:43 UTC
RE: [SPAM] Re: How to handle Boolean/Checkboxes in ?
Will do when I understand a bit more and figure out how to wiki.
Regards,
Yee
-----Original Message-----
From: Mathias Brökelmann [mailto:mbroekelmann@googlemail.com]
Sent: Sunday, 6 November 2005 9:49 PM
To: MyFaces Discussion; yeecn@streamyx.com
Subject: [SPAM] Re: How to handle Boolean/Checkboxes in <t:columns>?
Importance: Low
care to provide a patch or improve wiki documentation?
2005/11/6, Yee CN <ye...@streamyx.com>:
> Ah - I got the idea. I worked out the following, and I think it would be
> instructive to include it in myfaces example.
>
> public String getColumnDataType() {
> String columnDataType = null;
> return getColumnValue().getClass().getName();
> }
>
> public boolean isBooleanValue() {
> return getColumnDataType() == "java.lang.Boolean" ;
> }
>
> public boolean isStringValue() {
> return getColumnDataType() == "java.lang.String" ;
> }
>
> Many thanks.
>
> Regards,
> Yee
>
> -----Original Message-----
> From: Mathias Brökelmann [mailto:mbroekelmann@googlemail.com]
> Sent: Sunday, 6 November 2005 4:00 PM
> To: MyFaces Discussion
> Subject: Re: How to handle Boolean/Checkboxes in <t:columns>?
>
> you can switch it by using the rendered attribute. Provide some is
> methods for the datatype and check it through the rendered attribute.
> Put them inside the t:columns component. You can nest them into
> h:panelGroup if you have more than one component to render for a
> specific datatype.
>
> <h:selectBooleanCheckbox rendered="#{userRolesBean.booleanValue}"
> value="#{userRolesBean.columnValue}"/>
> <h:inputText rendered="#{userRolesBean.stringValue}"
> value="#{userRolesBean.columnValue}"/>
>
> 2005/11/6, Yee CN <ye...@streamyx.com>:
> > Does that mean that all columns must be Boolean/Boolean? So there is no
> way
> > of mixing datatype in different columns?
> >
> > Regards
> > Yee
> >
> > -----Original Message-----
> > From: Mathias Brökelmann [mailto:mbroekelmann@googlemail.com]
> > Sent: Sunday, 6 November 2005 1:05 AM
> > To: MyFaces Discussion
> > Subject: Re: How to handle Boolean/Checkboxes in <t:columns>?
> >
> > your userRolesBean.columnValue must return a boolean value. Either
> > primitive, instance of java.lang.Boolean or null.
> >
> > 2005/11/5, Yee CN <ye...@streamyx.com>:
> > >
> > >
> > >
> > > Hi,
> > >
> > >
> > >
> > > How should I handle boolean and checkboxes using <t:columns>?
> > >
> > >
> > >
> > > I am trying to do something like:
> > >
> > >
> > >
> > > <t:columns id="columns" value="#{userRolesBean.columnHeaders}"
> > > var="columnHeader">
> > >
> > > <f:facet name="header">
> > >
> > >
> > >
> > > </f:facet>
> > >
> > > <h:selectBooleanCheckbox id="selboolean"
> > > value="#{userRolesBean.columnValue}"/>
> > >
> > > </t:columns>
> > >
> > >
> > >
> > > But then I get the following exception:
> > >
> > > java.lang.IllegalArgumentException: Expected submitted
> > > value of type Boolean for Component : {Component-Path : [Class:
> > > javax.faces.component.UIViewRoot,ViewId:
> > >
> > >
> > >
> > >
> > >
> > > Thanks,
> > >
> > >
> > >
> > > Regards,
> > >
> > > Yee
> >
> >
> > --
> > Mathias
> >
> >
>
>
> --
> Mathias
>
>
--
Mathias