Hi Carl,

The following sample uses a custom component to change the backgroundColor of a DataGrid row; conditionally with CSS.

http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectID=487 

-TH

--- In [email protected], "carl_steinhilber" <[EMAIL PROTECTED]> wrote:
>
> I'm setting the dataProvider of a DataGrid to an ArrayCollection (of
> Objects).
>
> If the value of a given field of a given row is a particular value, I
> want to change the row of the DataGrid to red, say.
>
> I already have a labelFunction on the DataGridColumn for something else.
>
> And Brandon Purcell tells me that setting the background color of a
> row is fairly easy:
>
> dg.setPropertiesAt(rowNum, {backgroundColor:0xFF0000});
>
> Is it possible to determine the row number of the row that a
> labelFunction is currently affecting, so that I could also do a
> setPropertiesAt() and pass it said row number?
>
> In other words... I have
>
> <mx:DataGrid name="dg" id="dg" width="100%" height="100%">
> <mx:columns>
> <mx:DataGridColumn dataField="date" labelFunction="formatDate"
> headerText="Date" />
> </mx:columns>
> </mx:DataGrid>
>
> and my formatDate function wants to look like:
>
> public function
> formatDate(columnData:Object,columnDef:DataGridColumn):String
> {
> dg.setPropertiesAt(whateverRowThisIs, {backgroundColor:0xFF0000});
> DateDisplay.format(columnData.date);
> }
>
> Anyone know how to determine "whateverRowThisIs"?
>
> Or do I really need to use a itemRenderer? That seems like overkill to
> just change the background color.
>
> Any help would be appreciated.
>
> Thanks!
> -Carl
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to