Thanks Alex - Will do. I'm only relatively new at Flex and getting something working was much higher priority than lightweight or heavyweight renderers.
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Subclassing Text makes for heavyweight renderers. See the examples on > my blog (blogs.adobe.com/aharui) > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of valdhor > Sent: Thursday, February 14, 2008 11:06 AM > To: [email protected] > Subject: [flexcoders] Re: problem in applying CSS programitcally > > > > 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] <mailto:flexcoders%40yahoogroups.com> > , "M.Javed" <mjavedhussain@> 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 > <http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ> > > >

