Thanks for the response (I can't believe how hard it's been trying to find this out!). I'm trying to use the following component in a DataGrid, but "listData" is evaluating to NULL when I debug the application:
<?xml version="1.0" encoding="utf-8"?> <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml" textAlign="center"> <mx:Script> <![CDATA[ import mx.controls.dataGridClasses.DataGridListData; private function getData():Object { var columnMetadata:DataGridListData = DataGridListData(listData) var fieldName:String = columnMetadata.dataField; return data[fieldName]; } private function getFormattedDate():String { return df.format(getData()); } ]]> </mx:Script> <mx:DateFormatter id="df" formatString="DD-MMM-YY"/> <mx:Label text="{getFormattedDate()}"/> </mx:Label> Am I being dense? --- In flexcoders@yahoogroups.com, "ben.clinkinbeard" <[EMAIL PROTECTED]> wrote: > > Yes, you'll want to look into the listData property. Flex > automatically populates it for drop-in editors and renderers, so if > your renderer implements IDropInListItemRenderer or inherits from a > class that does (Button, Label, ComboBox, plus 11 more) then you will > be able to access listData. When your renderer is in a DataGrid, > listData will be of type DataGridListData, which provides properties > like dataField, columnIndex, rowIndex, etc. > > HTH, > Ben > > > --- In flexcoders@yahoogroups.com, "triggersoftware" <david.bates@> > wrote: > > > > Is there any way I can access the "dataField" field from within a > > custom item renderer? > > > > <mx:DataGridColumn itemRenderer="MyCustomComponent" > > dataField="startDate"/> > > <mx:DataGridColumn itemRenderer="MyCustomComponent" > dataField="endDate"/> > > > > In this case the component MyCustomComponent would know to look at the > > data.startDate field when displaying the first column and the > > data.endDate field when displaying the second column. I would imagine > > the component to look something like: > > > > <mx:Label text="{formatter.format(data[dataField])}"/> > > >