editorDataField="selectedDate"

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Cosma
Sent: Wednesday, April 04, 2007 8:34 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] DataGrid, error using DateField as the item editor



Hello,

I'm trying to create an editable DataGrid using Flex 2.0.1. One of the
columns is of Date type, so I want to use a DateField as the item
editor.

The problem is that I'm getting an error when the focus is taken away
from the DateField:

TypeError: Error #1034: Assegnazione di tipo forzata non riuscita:
impossibile convertire "01/10/1980" in Date.
at mx.controls::DataGrid/::itemEditorItemEditEndHandler()

It seems that the DataGrid is trying to assign back the raw string
value into my data provider object.

This is a code snippet that reproduce the problem:

<mx:Script>
<![CDATA[
[Bindable]
private var rows:ArrayCollection = new ArrayCollection();
private function init():void {
// called on creationComplete
var testRow:PersonVO = new PersonVO();
testRow.name = "Name";
testRow.surname = "Surname";
testRow.birthDate = new Date(1980, 9, 1);
rows.addItem(testRow);
}
]]>
</mx:Script>
<mx:DataGrid dataProvider="{rows}" editable="true">
<mx:columns>
<mx:DataGridColumn dataField="name"/>
<mx:DataGridColumn dataField="surname"/>
<mx:DataGridColumn dataField="birthDate">
<mx:itemEditor>
<mx:Component>
<mx:DateField formatString="DD/MM/YYYY"/>
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>

Do you have any idea of the cause of this behaviour?

Thanks
Cosma



 

Reply via email to