There appears to be a bug with the formatter property of
AdvancedDataGridColumn.  It seems to display my GMT offset where it
should be displaying the year.  A format string of MM/DD/YYYY is
displaying as 03/03/500, while a format string of MM/DD/YY is displaying
as 03/03/0.  Using the same formatter object with a function to
display the date in a label works as expected.  I haven't tried all
mask chars but of those I tried only Y had a problem.  This is with
the release version of flex 3.  Here is a simple example demonstrating
the problem.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical">
        
        <mx:Script>
                <![CDATA[
                        import mx.collections.ArrayCollection;
                
                [Bindable] private var dateData:ArrayCollection = new 
ArrayCollection([
                        {timeStamp: new Date()}, {timeStamp: new Date()}
                        ]);

                        private function formatDate(date:Date):String
                        {
                                return formatter1.format(date);
                        }                       
                ]]>
        </mx:Script>
        
        <mx:DateFormatter id="formatter1" formatString="MM/DD/YYYY"/>
        <mx:DateFormatter id="formatter2" formatString="MM/DD/YY"/>
        <mx:DateFormatter id="defaultFormatter" />

        <mx:Label text="{formatDate(dateData.getItemAt(0).timeStamp)}"/>
        <mx:AdvancedDataGrid id="auditGrid" dataProvider="{dateData}">
                <mx:columns>
                        <mx:AdvancedDataGridColumn dataField="timeStamp"
headerText="formatter1" width="150" 
                                formatter="{formatter1}"/>
                        <mx:AdvancedDataGridColumn dataField="timeStamp"
headerText="formatter2" width="150" 
                                formatter="{formatter2}"/>
                        <mx:AdvancedDataGridColumn dataField="timeStamp"
headerText="default" width="150" 
                                formatter="{defaultFormatter}"/>
                        <mx:AdvancedDataGridColumn dataField="timeStamp"
headerText="unformatted" width="250" />
                        </mx:columns>
        </mx:AdvancedDataGrid>

</mx:Application>


Reply via email to