2 Replies Latest reply on Apr 10, 2008 2:27 AM by Sreenivas R

    Datagrid dateField as itemEditor

    ethernutZA Level 1
      I have been struggling for over a week on this issue now:

      I have a datagrid of which the dataProvider is a remoteObject from AMFPHP. It consists of columns taskid,task_description, due_date and person_responsible. The problem is as follows:

      The due_date field should be a dateField itemEditor. If i follow this example http://shigeru-nakagaki.com/flex_samples/DataGrid/DateFieldEditor/DateFieldEditor.html
      then the datefield works fine, but i cannot retrieve the new date value from the 'getCellInfo(event:DataGridEvent)' once I have selected it. I can always retrieve the previous value easily, but not new value. To complicate things further, other methods throw the implicit coersion error for string/object to date and vice versa. There is also no way of specifying the due_date field as a type date within the remoteObject either.

      Any help will be greatly appreciated.

        • 1. Re: Datagrid dateField as itemEditor
          peterskeeter Level 1
          I had similar problem about getting previous values and not new ones...i fixed mine by using a lower priority in the addEventListener call for the datagrid. i.e here is my comment to self in my code...

          //-- A datagrid updates its dataprovider via an automatic eventlistener with a priority at -50.
          //-- So we need a lower priority (-100) for our eventlistener if we are to see the NEW
          //-- post edited value from the datagrid. Otherwise we would get a default 0 (zero)
          //-- priority if we didnt explicitly set an eventlistener priority and only see the original
          //-- value that we were editing and not the new one.

          my snippet follows...

          DG_class_students.addEventListener(DataGridEvent.ITEM_EDIT_END, comment_changed, false, -100);

          Hope this helps...
          • 2. Re: Datagrid dateField as itemEditor
            Sreenivas R Adobe Employee
            if you use the DateFieldEditor sample you are referring to after editing operation is over the datafield should have the new selected date as a string.

            From your explanation it is not very clear what is the problem you are facing when you are using the sample code.

            DateField can be used a editor directly only if the value type is Date otherwise you have to extend it similar to the example to convert back and forth between Date and String types.

            What is the getCellInfo function you are referring?