[flexcoders] Re: How to change DataGridCell font color based on the cell value

2007-03-23 Thread rzilist
Iko,

Thanks a lot for your help. Works like a charm.
Roman


--- In flexcoders@yahoogroups.com, iko_knyphausen [EMAIL PROTECTED] wrote:

 
 small correction: the initial canvas tag should be without the 
forward
 slash...like
 
 mx:canvas ...
 
 
 --- In flexcoders@yahoogroups.com, iko_knyphausen iko@ wrote:
 
 
  You could do a cutom itemRenderer that is based on a canvas, put 
a
 label
  for your text (cell value) and overwrite the set data method.
 
  mx:canvas/
  mx:Label id=myLabel text=/
  mx:Script
  ![CDATA[
  import mx.core.*;
 
 
 
  override public function set data(data:Object) : void
  {
  if (data != null)
  {
  super.data = data;
  if ( Number(data.YOURDATAFIELD)  0 )
  myLabel.setStyle(color,#ff);
  else
  myLabel.clearStyle(color);
 
  myLabel.text = data.YOURDATAFIELD;
 
  }
  }
 
  ]]
  /mx:Script
  /mx:Canvas
 
 
 
  }
 
 
 
 
  --- In flexcoders@yahoogroups.com, rzilist rzilist@ wrote:
  
   Hi folks,
   I need to change the font color on my last DataGridColumn (not 
the
   ColumnHeader, just the cells) based on the cell value, i.e. if 
value
   in the cell is negative, change the cell font color to red. 
I've
 tried
   various HTMLRenderer classes, but to no avail. Please help!
   Thanks,
   Roman
  
 





[flexcoders] Re: How to change DataGridCell font color based on the cell value

2007-03-22 Thread iko_knyphausen

You could do a cutom itemRenderer that is based on a canvas, put a label
for your text (cell value) and overwrite the set data method.

mx:canvas/
mx:Label id=myLabel text=/
mx:Script
![CDATA[
import mx.core.*;



override public function set data(data:Object) : void
{
if (data != null)
{
   super.data = data;
   if ( Number(data.YOURDATAFIELD)  0 )
  myLabel.setStyle(color,#ff);
   else
  myLabel.clearStyle(color);

   myLabel.text = data.YOURDATAFIELD;

}
}

]]
/mx:Script
/mx:Canvas



}




--- In flexcoders@yahoogroups.com, rzilist [EMAIL PROTECTED] wrote:

 Hi folks,
 I need to change the font color on my last DataGridColumn (not the
 ColumnHeader, just the cells) based on the cell value, i.e. if value
 in the cell is negative, change the cell font color to red. I've tried
 various HTMLRenderer classes, but to no avail. Please help!
 Thanks,
 Roman





[flexcoders] Re: How to change DataGridCell font color based on the cell value

2007-03-22 Thread iko_knyphausen

small correction: the initial canvas tag should be without the forward
slash...like

mx:canvas ...


--- In flexcoders@yahoogroups.com, iko_knyphausen [EMAIL PROTECTED] wrote:


 You could do a cutom itemRenderer that is based on a canvas, put a
label
 for your text (cell value) and overwrite the set data method.

 mx:canvas/
 mx:Label id=myLabel text=/
 mx:Script
 ![CDATA[
 import mx.core.*;



 override public function set data(data:Object) : void
 {
 if (data != null)
 {
 super.data = data;
 if ( Number(data.YOURDATAFIELD)  0 )
 myLabel.setStyle(color,#ff);
 else
 myLabel.clearStyle(color);

 myLabel.text = data.YOURDATAFIELD;

 }
 }

 ]]
 /mx:Script
 /mx:Canvas



 }




 --- In flexcoders@yahoogroups.com, rzilist rzilist@ wrote:
 
  Hi folks,
  I need to change the font color on my last DataGridColumn (not the
  ColumnHeader, just the cells) based on the cell value, i.e. if value
  in the cell is negative, change the cell font color to red. I've
tried
  various HTMLRenderer classes, but to no avail. Please help!
  Thanks,
  Roman