Here is what works for me. I'm using Oracle in the back end and reading the dates into my own ArrayCollection. Since it is mm/dd/yyyy format from Oracle, the field is being treated as a string when placed in my ArrayCollection. When using an ItemRenderer of DateField for this data within a DataGrid, it tries to convert the text into a Date and fails. I have to convert my date field within the ArrayCollection to a Flex Date using an intermediate conversion into milliseconds using Date.parse...then use that to create a Flex Date field, and then set my field within my ArrayCollection to that...Once I do that, the use of the ItemRenderer is good..of course, i get the lovely task of converting back from a Flex Date into a string before sending my data back to my server for update, but it works. This looks like a bug in the DataGrid itself when passing data into the itemRender upon it's creation...or just a lack of flexibility with the type of date data possibly. I don't get this problem when using a DateField control whose data comes directly from my ArrayCollection field..only when using a DataGrid.
--- In [email protected], "Ralf Bokelberg" <[EMAIL PROTECTED]> wrote: > > Maybe it needs MM/TT/YYYY ? > Cheers, > Ralf. > > On 7/21/06, John Buhl <[EMAIL PROTECTED]> wrote: > > > > I still get this error when I select the date, tab off of the cell, and > > return back to that cell. > > Type Coercion failed: cannot convert "04/13/2005" to Date > > > > Is there something I am missing here? > > Here is my code below: > > > > <mx:DataGrid draggableColumns="true" id="dgVersions" dataProvider="{ > > getVersionRequest.lastResult.root.versions.VersionHeader}"> > > <mx:columns> > > <mx:DataGridColumn itemEditor="RendererDate" > > dataField="VERSIONACTIVEDATE" headerText="Active Date" width="100"/> > > </mx:columns> > > </mx:DataGrid> > > > > And this is my RendererDate.mxml component: > > <?xml version="1.0" encoding="utf-8"?> > > <mx:DateField xmlns:mx="http://www.adobe.com/2006/mxml"> > > <mx:Script> > > <![CDATA[ > > private function getActiveDate( data : Object ) : Date { > > return new Date( Date.parse (data.VERSIONACTIVEDATE)); > > > > } > > > > public override function set data( data : Object ) : void { > > super.data = data; > > selectedDate = getActiveDate( data ); > > } > > ]]> > > </mx:Script> > > </mx:DateField> > > > > > > On 7/20/06, Ralf Bokelberg <[EMAIL PROTECTED]> wrote: > > > > > Works for me, if i use the following external itemEditor > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > <mx:DateField xmlns:mx=" http://www.adobe.com/2006/mxml "> > > > <mx:Script> > > > <![CDATA[ > > > private function getActiveDate( data : Object ) : Date > > > { > > > return new Date( Date.parse ( data.MyActiveDate)); > > > } > > > > > > public override function set data( data : Object ) : > > > void > > > { > > > super.data = data; > > > selectedDate = getActiveDate( data ); > > > } > > > ]]> > > > </mx:Script> > > > > > > </mx:DateField> > > > > > > cheers, > > > Ralf. > > > > > > > > > > > > > > > On 7/20/06, John Buhl < [EMAIL PROTECTED]> wrote: > > > > > > > > Yes. The data can be parsed fine. I think I need somehow to use a > > > > Model with my XML so I can massage the data first, and then set the > > > > dataProvider to the Model instead of the XML object. Still researching... > > > > > > > > > > > > On 7/20/06, Tom Chiverton < [EMAIL PROTECTED]> wrote: > > > > > > > > > > On Thursday 20 July 2006 15:53, John Buhl wrote: > > > > > > field comes across as text, so I'm trying to cast it into a Date > > > > > object > > > > > > before using the cellRenderer component. But it just won't > > > > > work. Has > > > > > > > > > > What format is the data string in ? Is it one Date can parse itself > > > > > ? > > > > > > > > > > -- > > > > > Tom Chiverton > > > > > > > > > > **************************************************** > > > > > > > > > > This email is sent for and on behalf of Halliwells LLP. > > > > > > > > > > Halliwells LLP is a limited liability partnership registered in > > > > > England and Wales under registered number OC307980 whose registered office > > > > > address is at St James's Court Brown Street Manchester M2 2JF. A list of > > > > > members is available for inspection at the registered office. Any reference > > > > > to a partner in relation to Halliwells LLP means a member of Halliwells LLP. > > > > > Regulated by the Law Society. > > > > > > > > > > CONFIDENTIALITY > > > > > > > > > > This email is intended only for the use of the addressee named above > > > > > and may be confidential or legally privileged. If you are not the addressee > > > > > you must not read it and must not use any information contained in nor copy > > > > > it nor inform any person other than Halliwells LLP or the addressee of its > > > > > existence or contents. If you have received this email in error please > > > > > delete it and notify Halliwells LLP IT Department on 0870 365 8008. > > > > > > > > > > For more information about Halliwells LLP visit www.halliwells.com. > > > > > > > > > > > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor > > > > > > > > > > -- > > > > > Flexcoders Mailing List > > > > > FAQ: > > > > > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > > > > Search Archives: > > > > > http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > *********************** > > > > John Buhl > > > > 770-722-5209 (c) > > > > 770-234-6710 (f) > > > > *********************** > > > > > > > > > > > > > > > > -- > > > Ralf Bokelberg <[EMAIL PROTECTED]> > > > Flex & Flash Consultant based in Cologne/Germany > > > > > > > > > > > > -- > > *********************** > > > > John Buhl > > 770-722-5209 (c) > > 770-234-6710 (f) > > *********************** > > > > > > -- > Ralf Bokelberg <[EMAIL PROTECTED]> > Flex & Flash Consultant based in Cologne/Germany > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

