doing so causes my datagrid to be empty. any ideas why?
override public function set data(value:Object):void {
if (!value) return;
super.data=value;
//this.setStyle("backgroundColor","red");
// that line causes my grid to be empty if I leave it
// uncommented
}
--- In [email protected], "Jeremy Lu" <[EMAIL PROTECTED]> wrote:
>
> in that data() block, I would just use:
>
> this.setStyle("backgroundColor", "red");
>
> to change the item renderer's background color.
>
> see if this works.
>
> Jeremy.
>
> On 7/1/06, djbrown_rotonews <[EMAIL PROTECTED]> wrote:
> >
> > any help? is there a more elegant way to do it inside of set
data(),
> > or is the beginFill/drawRect/endFill method shown as good as it
gets?
> >
> > --- In [email protected] <flexcoders%40yahoogroups.com>,
> > "djbrown_rotonews"
> >
> > <djbrown_rotonews@> wrote:
> > >
> > > Is the beginFill/drawRect/endFill the only way to do it inside
of
> > > set data() as well, or is there an alternate way?
> > >
> > > --- In [email protected] <flexcoders%
40yahoogroups.com>,
> > "Jeremy Lu" <wade.lu@> wrote:
> > > >
> > > > Got it, thanks :-)
> > > >
> > > >
> > > >
> > > > On 6/27/06, Joan Tan <tan@> wrote:
> > > > >
> > > > > I believe that this was suggested to me by Alex. I think
> > your
> > > way
> > > > > should work too though.
> > > > >
> > > > >
> > > > > ------------------------------
> > > > >
> > > > > *From:* [email protected] <flexcoders%
40yahoogroups.com>
> > > [mailto:[email protected] <flexcoders%
40yahoogroups.com>] *On
> > > > > Behalf Of *Jeremy Lu
> > > > > *Sent:* Monday, June 26, 2006 4:22 PM
> > > > > *To:* [email protected] <flexcoders%
40yahoogroups.com>
> > > > > *Subject:* Re: [flexcoders] Re: coloring an entire cell in
a
> > > DataGrid?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > hi Joan,
> > > > >
> > > > > Just wondering is there any particular reason that you
don't
> > > change the
> > > > > background color in the data() setter like this:
> > > > >
> > > > > public function set data(value:Object
> > >
> >
<http://../../../Object.html>):void<http://../../../specialTypes.html
> > > #void>
> > > > > {
> > > > >
> > > > > if( value.myColumnName > 50){
> > > > > //change bg to red
> > > > > }else{
> > > > > //change to other color
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > > Jeremy.
> > > > >
> > > > > On 6/27/06, *Joan Tan* <tan@> wrote:
> > > > >
> > > > > The "color" style of Text only affects the text and the
not the
> > > > > background. Text doesn't actually have a background color
so
> > you
> > > must create
> > > > > an itemRenderer with a backgroundColor and then set it.
This
> > > example was
> > > > > posted on another flexcoders thread entitled "datagrid".
This
> > > itemRenderer
> > > > > will turn the background of a row to red if the value of
the
> > > column
> > > > > "myColumnName" in that row is over 50.
> > > > >
> > > > >
> > > > >
> > > > > package {
> > > > >
> > > > >
> > > > >
> > > > > import mx.controls.Label;
> > > > >
> > > > > import mx.controls.dataGridClasses.*;
> > > > >
> > > > > import mx.controls.DataGrid;
> > > > >
> > > > > import flash.display.Graphics;
> > > > >
> > > > > import mx.styles.StyleManager;
> > > > >
> > > > >
> > > > >
> > > > > [Style(name="backgroundColor", type="uint", format="Color",
> > > > > inherit="no")]
> > > > >
> > > > >
> > > > >
> > > > > public class BackgroundComp extends Label {
> > > > >
> > > > >
> > > > >
> > > > > 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;
> > > > >
> > > > > if (data.myColumnName > 50)
> > > > >
> > > > > {
> > > > >
> > > > > g.beginFill(0xFF0000);
> > > > >
> > > > > g.drawRect(0, 0, unscaledWidth,
> > > unscaledHeight);
> > > > >
> > > > > g.endFill();
> > > > >
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ------------------------------
> > > > >
> > > > > *From:* [email protected] <flexcoders%
40yahoogroups.com>
> > > [mailto:[email protected] <flexcoders%
40yahoogroups.com>] *On
> > > > > Behalf Of *djbrown_rotonews
> > > > > *Sent:* Monday, June 26, 2006 10:13 AM
> > > > > *To:* [email protected] <flexcoders%
40yahoogroups.com>
> > > > > *Subject:* [flexcoders] Re: coloring an entire cell in a
> > > DataGrid?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > I'm using an itemRenderer to set the text color via the
> > setStyle
> > > > > ("color",<color>) construct, but it doesn't appear to be
that
> > > simple
> > > > > for backgroundColor. Is the data() method part of the
renderer
> > > API?
> > > > >
> > > > > --- In [email protected] <flexcoders%
40yahoogroups.com><flexcoders%
> > > 40yahoogroups.com>, "Jeremy
> > > > > Lu" <wade.lu@> wrote:
> > > > > >
> > > > > > Using item renderer, yes.
> > > > > >
> > > > > > Check it in the manual and pay attention to data()
method.
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 6/26/06, djbrown_rotonews <djbrown_rotonews@> wrote:
> > > > > > >
> > > > > > > Is there a way to color the entire cell, and not sure
the
> > > cell
> > > > > text
> > > > > > > itself, inside a DataGrid?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> >
> >
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/