Genius! Was just having that problem with another I wrote...
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Better, but will fail if you scroll. Renderers get recycled and
> creatuinComplete only gets fired once.
>
>
>
> Use the dataChange event instead
>
>
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of triggersoftware
> Sent: Wednesday, November 14, 2007 9:14 AM
> To: [email protected]
> Subject: [flexcoders] Re: Accessing dataField from within a Custom Item
> Renderer
>
>
>
> Yup...I was being dense:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> "
> textAlign="center" creationComplete="setText()">
> <mx:Script>
> <![CDATA[
> import mx.controls.dataGridClasses.DataGridListData;
>
> private function getFormattedDate():String {
> var columnMetadata:DataGridListData = DataGridListData(listData)
> var fieldName:String = columnMetadata.dataField;
> var data:Object = data[fieldName];
>
> return df.format(data);
> }
>
> private function setText():void {
> text = getFormattedDate();
> }
> ]]>
> </mx:Script>
> <mx:DateFormatter id="df" formatString="DD-MMM-YY"/>
> </mx:Label>
>