You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Delange <de...@telfort.nl> on 2012/08/16 12:20:24 UTC

Dataview: need a differente css for negative values

Hi, in my DataView I have a column with amounts.
I want to give the positive ones a green color, and the negative ones a red
color;

How to accomplish that?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dataview-need-a-differente-css-for-negative-values-tp4651270.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Dataview: need a differente css for negative values

Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
Assuming you use a Label for your amounts:

new Label( ... ) {
     @Override
     protected void onComponentTag(ComponentTag tag) {
         super.onComponentTag(tag);
         if( isNumberPositive() )
             tag.append("class", "positive_num_css", " ");
         else
             tag.append("class", "negative_num_css", " ");
     }
}

Bertrand

On 16/08/2012 6:20 AM, Delange wrote:
> Hi, in my DataView I have a column with amounts.
> I want to give the positive ones a green color, and the negative ones a red
> color;
>
> How to accomplish that?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dataview-need-a-differente-css-for-negative-values-tp4651270.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org