In place of:

if (data.accountBalance < 0)
{
   accountBalance.setStyle("color","red");
}

Use something like this:

switch(data.yourDataField) {
    case "Sunday":
      yourItemRendererField.setStyle("color","red");
      break;
    case "Monday":
      yourItemRendererField.setStyle("color","blue");
      break;
    case "Tuesday":
      yourItemRendererField.setStyle("color","green");
      break;
    case "Wednesday":
      yourItemRendererField.setStyle("color","purple");
      break;
    default:
      yourItemRendererField.setStyle("color","black");
}

-TH

--- In [email protected], "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
> Subba,
> 
> The itemRenderer, in the example, checks each individual row one 
at 
> a time as it renders.  That's why the example has some red and 
some 
> black row items.  You can use this method to set your columns' 
> individual row items to any color conditionally.  Maybe, I'm not 
> understanding exactly what you are trying to do.
> 
> Tim
> 
> --- In [email protected], "Subba Chalamalasetty" 
> <subba@> wrote:
> >
> > Hi Tim,
> > 
> > I checked the example. Again it is checking the entire column 
data 
> and
> > setting the color..
> > 
> > public function init():void
> >             {
> >                 if (data.accountBalance < 0)
> >                 {
> >                     accountBalance.setStyle("color","red");
> >                 }
> >             }
> >  
> > I am planning to write a loop like(while or for)
> >   While(data.accountBalance is not empty) 
> >       Change the color for each element i.e .setStyle("","");
> >  
> > Thanks,
> > Subba
> > 
> > .
> > 
> > ________________________________
> > 
> > From: [email protected] 
> [mailto:[EMAIL PROTECTED] On
> > Behalf Of Tim Hoff
> > Sent: Thursday, June 15, 2006 10:53 AM
> > To: [email protected]
> > Subject: [flexcoders] Re: DataGridColumn Item Renderer
> > 
> >  
> > 
> > Hi Subba,
> > 
> > Here is a very simple example of how to do that:
> > 
> > http://www.cflex.net/showfiledetails.cfm?
> ChannelID=1&Object=File&objectI
> > D=443
> > <http://www.cflex.net/showfiledetails.cfm?
> ChannelID=1&Object=File&object
> > ID=443>  
> > 
> > You can right-click on the example to see the code.  I hope that 
> this
> > helps you,
> > Tim Hoff
> > 
> > 
> > --- In [email protected], "Subba Chalamalasetty" 
<subba@>
> > wrote:
> > >
> > > I have a data grid and there are 10 columns and 5 rows in 
that. 
> I am
> > > trying to use itemRenderer = "myRenderer"
> > > 
> > > ----- myRenderer.mxml ------
> > > 
> > > 
> > > 
> > > <?xml version="1.0" encoding="utf-8"?>
> > > 
> > > <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml";>
> > > 
> > > <mx:Label textAlign="right" text="{data.name}" alpha="0.1"
> > > color="#ff0033" width="100%" /> 
> > > 
> > > 
> > > 
> > > </mx:VBox>
> > > 
> > > 
> > > 
> > > I want to have different colors for each name. In the above 
> code, as i
> > > am giving {data.name}, I am getting all the names with same 
> color.
> > > 
> > > 
> > > 
> > > I want to access each element(cell) in that column(column 
> name=name)
> > and
> > > give each name with different color. Can somebody help me with 
> this?
> > > 
> > > 
> > > 
> > > Thanks
> > >
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
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/
 


Reply via email to