You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Roland Chan <rc...@casebank.com> on 2005/04/14 22:56:39 UTC

Row color based on content?

I'd like to specify a row color based on some content.  For example, the row
should be background color green if the statusName column has a value of
'active'.
 
Can anyone direct me on what the most efficient way of doing this is.
 
My table currently looks like this:
 
        <table border="1" cellspacing="1" bordercolor="#FFFFFF" width="100%"
jwcid="table@contrib:Table" class="pcpList"
                  source="ognl:procedure.numberedSteps"
                  columns="stepNo, truncatedInstruction, statusName,
primaryName" pageSize="5">
            <span jwcid="stepNoColumnValue@Block">
                        <span jwcid="stepNoLink">
                     <span jwcid="stepNoText"></span>
                        </span>
            </span>
        </table>
 
Thanks,
Roland
 
 

Re: Row color based on content?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 14, 2005, at 8:43 PM, Roland Chan wrote:
> Thanks, Eric.  Can you describe where and how I would add such a 
> condition?
> In a new bean?  Within the .page file?  Tap newbie here... :)

rowsClass="ognl:row.statusName == 'active' ? 'active' : null"

I think null will work here, but if not, use 'default' or something 
like that.  Now in your CSS add a style for class 'active' which is 
green for the background color.

There is another step here, and that is to have the row handy:

	row="ognl:row" on the table.

Then add a <property-specification name="row"/> in the .page file.

	Erik


>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: April 14, 2005 8:21 PM
> To: Tapestry users
> Subject: Re: Row color based on content?
>
>
> On Apr 14, 2005, at 4:56 PM, Roland Chan wrote:
>
>> I'd like to specify a row color based on some content.  For example,
>> the row
>> should be background color green if the statusName column has a value
>> of
>> 'active'.
>>
>> Can anyone direct me on what the most efficient way of doing this is.
>>
>> My table currently looks like this:
>>
>>         <table border="1" cellspacing="1" bordercolor="#FFFFFF"
>> width="100%"
>> jwcid="table@contrib:Table" class="pcpList"
>>                   source="ognl:procedure.numberedSteps"
>>                   columns="stepNo, truncatedInstruction, statusName,
>> primaryName" pageSize="5">
>
> Add a rowsClass attribute.  To zebra-stripe a table, I do this:
>
> 	rowsClass="ognl:beans.evenOdd.next + 'Row'"
>
> with the EvenOdd bean defined in the .page file like this:
>
> 	<bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
>
> You can add whatever condition you like, though.
>
> 	Erik
>
>>             <span jwcid="stepNoColumnValue@Block">
>>                         <span jwcid="stepNoLink">
>>                      <span jwcid="stepNoText"></span>
>>                         </span>
>>             </span>
>>         </table>
>>
>> Thanks,
>> Roland
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Row color based on content?

Posted by Roland Chan <rc...@casebank.com>.
Thanks, Eric.  Can you describe where and how I would add such a condition?
In a new bean?  Within the .page file?  Tap newbie here... :)

-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com] 
Sent: April 14, 2005 8:21 PM
To: Tapestry users
Subject: Re: Row color based on content?


On Apr 14, 2005, at 4:56 PM, Roland Chan wrote:

> I'd like to specify a row color based on some content.  For example, 
> the row
> should be background color green if the statusName column has a value 
> of
> 'active'.
>
> Can anyone direct me on what the most efficient way of doing this is.
>
> My table currently looks like this:
>
>         <table border="1" cellspacing="1" bordercolor="#FFFFFF" 
> width="100%"
> jwcid="table@contrib:Table" class="pcpList"
>                   source="ognl:procedure.numberedSteps"
>                   columns="stepNo, truncatedInstruction, statusName,
> primaryName" pageSize="5">

Add a rowsClass attribute.  To zebra-stripe a table, I do this:

	rowsClass="ognl:beans.evenOdd.next + 'Row'"

with the EvenOdd bean defined in the .page file like this:

	<bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>

You can add whatever condition you like, though.

	Erik

>             <span jwcid="stepNoColumnValue@Block">
>                         <span jwcid="stepNoLink">
>                      <span jwcid="stepNoText"></span>
>                         </span>
>             </span>
>         </table>
>
> Thanks,
> Roland
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Row color based on content?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 14, 2005, at 4:56 PM, Roland Chan wrote:

> I'd like to specify a row color based on some content.  For example, 
> the row
> should be background color green if the statusName column has a value 
> of
> 'active'.
>
> Can anyone direct me on what the most efficient way of doing this is.
>
> My table currently looks like this:
>
>         <table border="1" cellspacing="1" bordercolor="#FFFFFF" 
> width="100%"
> jwcid="table@contrib:Table" class="pcpList"
>                   source="ognl:procedure.numberedSteps"
>                   columns="stepNo, truncatedInstruction, statusName,
> primaryName" pageSize="5">

Add a rowsClass attribute.  To zebra-stripe a table, I do this:

	rowsClass="ognl:beans.evenOdd.next + 'Row'"

with the EvenOdd bean defined in the .page file like this:

	<bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>

You can add whatever condition you like, though.

	Erik

>             <span jwcid="stepNoColumnValue@Block">
>                         <span jwcid="stepNoLink">
>                      <span jwcid="stepNoText"></span>
>                         </span>
>             </span>
>         </table>
>
> Thanks,
> Roland
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org