0 Replies Latest reply on Feb 23, 2009 9:06 AM by conorgriffin

    MySQL and DateField

    conorgriffin
      Hi all, I have a MySQL database which stores has a table column of type 'date'. MySQL stores dated in the format YYYY-MM-DD.

      I have a flex app which populates a datagrid from an arraycollection which is derived from the MySQL table.

      My problem is that I want the itemEditor for the date column to be a DateField, but Flex is giving runtime errors saying it cannot convert the string to a date.

      See attached code for datagridcolumn at the end of the post



      and here is the error I get at runtime..

      quote:

      TypeError: Error #1034: Type Coercion failed: cannot convert "2009-12-24" to Date.
      at mx.controls::DateField/set data()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\controls\DateField.as:742]
      at mx.controls::DataGrid/itemEditorItemEditBeginHandler()[C:\autobuild\3.2.0\frameworks\proj ects\framework\src\mx\controls\DataGrid.as:4775]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9298]
      at mx.controls::DataGrid/commitEditedItemPosition()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\controls\DataGrid.as:3683]
      at mx.controls::DataGrid/updateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framewor k\src\mx\controls\DataGrid.as:1500]
      at mx.controls.listClasses::ListBase/validateDisplayList()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\controls\listClasses\ListBase.as:3280]
      at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:622]
      at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:695]
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
      at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]




      Can anyone help me to solve this?

      Do I need to use the labelfunction for the itemEditor?