There are various ways.

The easiest is to declare your array/object of colors as a static
const somewhere so you can reference it directly.  That has obvious
problems, of course.

If you implement IDropInDataListRenderer (I think?) you get a listData
object which you can cast to DataGridListData and from there reference
back to the DataGrid and/or it's columns.  If you're using a custom
subclass of DataGrid that accepts colors, you can reference them that
way.  Still have the dependency issues, but they're a bit more
constrained.

Finally, you can also use a custom ClassFactory as the value of
itemRenderer, instead of implicitly using the default (which mxmlc
configures for you), and parameterize your instances that way.

Of the three, I'd say the last is the best, but it's the most
cumbersome to actually implement.  There's probably other ways as
well.

cheers,
barneyb

On 7/9/07, Ian Skinner <[EMAIL PROTECTED]> wrote:
> I have a custom item render setup for a datagrid cell.  What I would
> like to happen is that the background color of the render to be based on
> a value from an array determined by the data.severity integer.  How
> might one do this?
>
> TIA
> Ian
>
> <mx:DataGridColumn dataField="severity" headerText="Severity"
> itemRenderer="Components.Renderers.severity"/>
>
> Component.Renderers.severity.mxml
> ---------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml";
>         textAlign="center"
>         verticalGap="0" horizontalGap="0">
>         <mx:Label text="{data.severity}" width="100%" minHeight="0" />
> </mx:VBox>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:4354
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37

Reply via email to