I ran into this problem awhile back and found you could not use CSS to
set the background color of a cell. This is the full itemrenderer I
came up with:

package renderers
{
        import mx.controls.*;
        import mx.controls.dataGridClasses.DataGridListData;
        import mx.utils.StringUtil;
        import flash.display.Graphics; 
        
        public class BackgroundColorCellField extends Text
        {
                private var fieldValue:String;
                
                public function BackgroundColorCellField ()
                {
                        super();
                }

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

                                text = StringUtil.trim(fieldValue);
                        }
                }
                
                override protected function 
updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void 
        { 
            super.updateDisplayList(unscaledWidth, unscaledHeight); 
            var g:Graphics = graphics; 
            g.clear(); 
            var grid1:DataGrid =
DataGrid(DataGridListData(listData).owner); 
            if (grid1.isItemSelected(data) ||
grid1.isItemHighlighted(data))
            {
                return; 
            }
            g.beginFill(0xBBBBBB); 
            g.drawRect(0, -2, unscaledWidth, unscaledHeight + 4);
g.endFill(); 
        }
        }
}


--- In [email protected], "M.Javed" <[EMAIL PROTECTED]> wrote:
>
> Hi, 
> Iam writing an itemRendere by extending DataGridItemRenderer, and
that itemRenderer changes the font style and background color of the
cell (which is basically TextBox in this case). All other styles apply
sucessfully except the background color, here is the CSS code iam using,
> 
> ----------------------------------------
> .dataGridCellGreen {
>     background : true;
>     backgroundColor: #CFF4C7;
>     color:#FF0000;
>     font-weight : bold;
> }
> ----------------------------------------
> 
> can anyone plz identify the problem ..... thanks in advance....
> 
> Regards,
> -J
> 
> 
>      
____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now. 
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>


Reply via email to