Yeh thats basically what I have but I also have variableRowHeight on my datagrid, with 2 or 3 of the cells in a row with wrapped text.
maybe its the variable row height that is causing the problem? --- In flexcoders@yahoogroups.com, Matt Chotin <[EMAIL PROTECTED]> wrote: > Hmm, you must have something going on that interferes. This little example > works for me: > > > > App.mxml > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*"> > > > > <mx:DataGrid dataProvider="{[{foo: 'bar'}, {foo: 'bar'}, {foo: > 'baz'}]}"> > > <mx:columns> > > <mx:Array> > > <mx:DataGridColumn columnName="foo" cellRenderer="bgCell"/> > > </mx:Array> > > </mx:columns> > > </mx:DataGrid> > > </mx:Application> > > > > bgCell.mxml > > <mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml"> > > > > <mx:Script> > > <![CDATA[ > > var value : String; > > > > function setValue(v) : Void > > { > > value = v; > > setStyle("backgroundColor", v == 'baz' ? 0xff0000 : undefined); > > } > > > > ]]> > > </mx:Script> > > > > <mx:Label text="{value}" /> > > > > </mx:VBox> > > > > Matt > > _____ > > From: Andrew Spaulding [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 02, 2005 8:11 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: simple datagrid cell colour renderer > > > > > Also, now that I overwrite these methods when i scroll up and down the > grid the rows gradually increase in height ... there must be a better > way to size the VBox? > > > > --- In flexcoders@yahoogroups.com, Matt Chotin <[EMAIL PROTECTED]> wrote: > > > > Did you try setting width/height to 100%? > > > > > > > > _____ > > > > From: Andrew Spaulding [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, February 02, 2005 8:01 PM > > To: flexcoders@yahoogroups.com > > Subject: [flexcoders] Re: simple datagrid cell colour renderer > > > > > > > > > > Thanks Matt, > > > > I had already taken that option, now I have to get the VBox to resize > > to the available space in the cell. I would assume this would mean > > overwriting the getPrefferedHeight and getPreferredWidth methods. > > > > Thanks, > > > > Andrew. > > > > > > > > > > > > --- In flexcoders@yahoogroups.com, Matt Chotin <[EMAIL PROTECTED]> wrote: > > > You could just use a VBox with a label inside of it. In the > > setValue method > > > you'd simply set the backgroundColor style on the VBox (in addition > > to the > > > text of the label). > > > > > > > > > > > > Matt > > > > > > > > > > > > _____ > > > > > > From: Andrew Spaulding [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, February 02, 2005 4:58 PM > > > To: flexcoders@yahoogroups.com > > > Subject: [flexcoders] simple datagrid cell colour renderer > > > > > > > > > > > > > > > Hi all, > > > > > > Im trying to write a cell renderer that changes the background colour > > > of a cell depending on the number that is displayed in it. > > > > > > Is this a simple task? I'm really struggling ... Should I make the > > > cell renderer a text box and just set the background colour on that? > > > > > > Best, > > > > > > Andrew. > > > > > > > > > > > > > > > > > > > > > _____ > > > > > > Yahoo! Groups Links > > > > > > * To visit your group on the web, go to: > > > http://groups.yahoo.com/group/flexcoders/ > <http://groups.yahoo.com/group/flexcoders/> > > <http://groups.yahoo.com/group/flexcoders/ > <http://groups.yahoo.com/group/flexcoders/> > > > > <http://groups.yahoo.com/group/flexcoders/ > <http://groups.yahoo.com/group/flexcoders/> > > <http://groups.yahoo.com/group/flexcoders/ > <http://groups.yahoo.com/group/flexcoders/> > > > > > > > > * To unsubscribe from this group, send an email to: > > > [EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED]> > > > > > > * Your use of Yahoo! Groups is subject to the Yahoo! > > > <http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> > <http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> > > > > Terms of Service. > > > > > > > > > > > > > > _____ > > > > Yahoo! Groups Links > > > > * To visit your group on the web, go to: > > http://groups.yahoo.com/group/flexcoders/ > <http://groups.yahoo.com/group/flexcoders/> > > <http://groups.yahoo.com/group/flexcoders/ > <http://groups.yahoo.com/group/flexcoders/> > > > > > * To unsubscribe from this group, send an email to: > > [EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]> > > > > * Your use of Yahoo! Groups is subject to the Yahoo! > > <http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> > > Terms of Service. > > > > > > > _____ > > Yahoo! Groups Links > > * To visit your group on the web, go to: > http://groups.yahoo.com/group/flexcoders/ > <http://groups.yahoo.com/group/flexcoders/> > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > * Your use of Yahoo! Groups is subject to the Yahoo! > <http://docs.yahoo.com/info/terms/> Terms of Service.