You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Anton Gavazuk <an...@gmail.com> on 2009/04/29 16:37:58 UTC

[JSF 1.2] conditions for table rows inside dataTable tag

Hi all,

question - is it possible to somehow manage table row items or even whole
table row inside dataTable tag:

what I want to get in result:

<h:dataTable var="raw">
   <h:column>
       <c:choose>
            <c:when test="condition1">
                   1
             </c:when>
            <c:otherwise>
                  2
             </c:otherwise>
       </c:choose>
   <h:column>
</h:dataTable>

I tried this, but it doesnt work and I suppose why. So is it possible
somehow to work with dataTable items in any way?

Thanks,
Anton

Re: [JSF 1.2] conditions for table rows inside dataTable tag

Posted by "Glauco P. Gomes" <gl...@yahoo.com.br>.
I don't know what happened in your case (why rendered="#{1==2}" 
evaluated to "true"), the "rendered" attribute accepts any boolean 
expression, take a look in this article to see the sintax and operators 
accepted by the EL:

http://developers.sun.com/docs/jscreator/help/2update1/jsp-jsfel/jsf_expression_language_intro.html

Glauco P. Gomes

Anton Gavazuk escreveu:
> Thanks,
>
> wanted something more 'dynamic'
>
> by the way which conditions accepts rendered attribute?
> I tried rendered="#{1==2}"
> and component is still being rendered - maybe I made mistake in 
> expression?
>
>
> 2009/4/29 Glauco P. Gomes <glaucopgomes@yahoo.com.br 
> <ma...@yahoo.com.br>>
>
>     Try this:
>
>
>     <h:dataTable var="raw">
>      <h:column>
>        <h:outputText value="1" rendered="#{condition1}" />
>        <h:outputText value="2" rendered="#{not condition1}" />
>      <h:column>
>     </h:dataTable>
>
>     Glauco P. Gomes
>
>     Anton Gavazuk escreveu:
>
>         Hi all,
>
>         question - is it possible to somehow manage table row items or
>         even whole table row inside dataTable tag:
>
>         what I want to get in result:
>
>         <h:dataTable var="raw">
>           <h:column>
>               <c:choose>
>                    <c:when test="condition1">
>                           1
>                     </c:when>
>                    <c:otherwise>
>                          2
>                     </c:otherwise>
>               </c:choose>
>           <h:column>
>         </h:dataTable>
>
>         I tried this, but it doesnt work and I suppose why. So is it
>         possible somehow to work with dataTable items in any way?
>
>         Thanks,
>         Anton
>
>
>


Re: [JSF 1.2] conditions for table rows inside dataTable tag

Posted by Anton Gavazuk <an...@gmail.com>.
Thanks,

wanted something more 'dynamic'

by the way which conditions accepts rendered attribute?
I tried rendered="#{1==2}"
and component is still being rendered - maybe I made mistake in expression?


2009/4/29 Glauco P. Gomes <gl...@yahoo.com.br>

> Try this:
>
> <h:dataTable var="raw">
>  <h:column>
>    <h:outputText value="1" rendered="#{condition1}" />
>    <h:outputText value="2" rendered="#{not condition1}" />
>  <h:column>
> </h:dataTable>
>
> Glauco P. Gomes
>
> Anton Gavazuk escreveu:
>
>  Hi all,
>>
>> question - is it possible to somehow manage table row items or even whole
>> table row inside dataTable tag:
>>
>> what I want to get in result:
>>
>> <h:dataTable var="raw">
>>   <h:column>
>>       <c:choose>
>>            <c:when test="condition1">
>>                   1
>>             </c:when>
>>            <c:otherwise>
>>                  2
>>             </c:otherwise>
>>       </c:choose>
>>   <h:column>
>> </h:dataTable>
>>
>> I tried this, but it doesnt work and I suppose why. So is it possible
>> somehow to work with dataTable items in any way?
>>
>> Thanks,
>> Anton
>>
>
>

Re: [JSF 1.2] conditions for table rows inside dataTable tag

Posted by "Glauco P. Gomes" <gl...@yahoo.com.br>.
Try this:

<h:dataTable var="raw">
   <h:column>
     <h:outputText value="1" rendered="#{condition1}" />
     <h:outputText value="2" rendered="#{not condition1}" />
   <h:column>
</h:dataTable>

Glauco P. Gomes

Anton Gavazuk escreveu:
> Hi all,
>
> question - is it possible to somehow manage table row items or even 
> whole table row inside dataTable tag:
>
> what I want to get in result:
>
> <h:dataTable var="raw">
>    <h:column>
>        <c:choose>
>             <c:when test="condition1">
>                    1
>              </c:when>
>             <c:otherwise>
>                   2
>              </c:otherwise>
>        </c:choose>
>    <h:column>
> </h:dataTable>
>
> I tried this, but it doesnt work and I suppose why. So is it possible 
> somehow to work with dataTable items in any way?
>
> Thanks,
> Anton


Re: [JSF 1.2] conditions for table rows inside dataTable tag

Posted by Cagatay Civici <ca...@gmail.com>.
Doesn't EL checks give you what you need. like rendered="condition" for
components to be rendered in that column for that condition.

On Wed, Apr 29, 2009 at 3:37 PM, Anton Gavazuk <an...@gmail.com>wrote:

> Hi all,
>
> question - is it possible to somehow manage table row items or even whole
> table row inside dataTable tag:
>
> what I want to get in result:
>
> <h:dataTable var="raw">
>    <h:column>
>        <c:choose>
>             <c:when test="condition1">
>                    1
>              </c:when>
>             <c:otherwise>
>                   2
>              </c:otherwise>
>        </c:choose>
>    <h:column>
> </h:dataTable>
>
> I tried this, but it doesnt work and I suppose why. So is it possible
> somehow to work with dataTable items in any way?
>
> Thanks,
> Anton
>