You may be better off overriding the set data function in your renderer.
The following is an example I have used in the past to create a
linkButton in a cell if the data is greater than zero or to gray it out
if it is zero:

package renderers
{
     import mx.controls.*;
     import mx.controls.dataGridClasses.DataGridListData;

     public class CellField extends LinkButton
     {
         private var fieldValue:String;

         public function CellField()
         {
             super();
         }

         override public function set data(value:Object):void
         {
             if(value != null)
             {
                 super.data = value;
                 fieldValue =
value[DataGridListData(listData).dataField];

                 label = fieldValue;
                 if (Number(fieldValue) == 0)
                 {
                     enabled = false;
                     useHandCursor = false;
                 }
                 else
                 {
                     enabled = true;
                     useHandCursor = true;
                     setStyle("color", "#FF0000");
                     setStyle("textDecoration", "underline");
                     setStyle("textRollOverColor:", "#0000CC");
                 }
             }
         }
     }
}


--- In [email protected], Fu Di <[EMAIL PROTECTED]> wrote:
>
> hi everyone,   i  wrote a  renderer  which  extends
DataGridItemRenderer   in  DataGrid
> some code below:
>
> override public function getTextStyles():TextFormat
>         {
>             if (!listData||this.text=="")
>             {
>                  return super.getTextStyles();
>             }
>
>             if(listData.uid != lastUID)
>             {
>                 var tf:TextFormat = super.getTextStyles();
>                 if(data is PositionDataBottomInfo)
>                 {
>                     tf.bold = true;
>
>                 }
>                 else
>                 {
>                     tf.bold = false;
>                 }
>             }
>             return tf;
>
>         }
>
> if  i  don't  operate  the DataGrid, every row's style is  correct. 
however , when  i scroll the DataGrid, the row's style is incorrect.
> after scrolling  some rows turn bold, some turn  normal.
>
> thinks
>

Reply via email to