That is one of the approaches I tried. I added a property called dateInMs, set the editorDataField to that name, and then overrode the get/set data, like what you mentioned. I could get it to display the correct date, but whenever I edited it, it would end up displaying NaN/Nan/Nan for the formatted date. I could see the millisec being changed to dates in the arraycollection (which isn't what I wanted), but I haven't been able to get them to stay millisec in the array collection, but display/edit as date objects. Very frustrating.
John --- In [email protected], Scott - FastLane <[EMAIL PROTECTED]> wrote: > > John - > > The problem is likely related to the DataGridColumn.editorDataField > property. If you are using DateField etc. for an editor this property > is "data" and it assumes that you will be assigning a Date object or a > String that is in a format that the Date class can parse. (as shown in > code snippet below). > > It seems you would have to extend DateField and override set > data(object:Value) or add a new property like dateMillis:Number then set > your column to have editorDataField="dateMillis", then write the > necessary code in your customized editor class. > > hth > Scott > > --- From DateField.as --- > public function set data(value:Object):void > { > var newDate:Date; > > _data = value; > > if (_listData && _listData is DataGridListData) > newDate = _data[DataGridListData(_listData).dataField]; > else if (_listData is ListData && ListData(_listData).labelField > in _data) > newDate = _data[ListData(_listData).labelField]; > else if (_data is String) > newDate = new Date(Date.parse(data as String)); > else > newDate = _data as Date; > > if (newDate && !selectedDateSet) > { > selectedDate = newDate; > selectedDateSet = false; > } > > dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); > } > > > j_lentzz wrote: > > > > Hi, > > > > I've been pounding away at a problem dealing with DataGrids and > > DateFields for a few days now. The problem is that I want to send and > > receive Dates from the server using milliseconds. However, in the > > data grid I want to display and edit Dates in MM/DD/YYYY format. One > > solution is to convert milliseconds to Dates and from Dates to > > milliseconds right as I send or receive data - and let the datagrid > > deal just with Dates. That is what I finally did to get it to work. > > What I would rather do is to not have to convert the data at the > > service calls/results, but to let the datagrid renderer and editors > > handle the conversion as necessary. However, I tried changing the > > get/set data methods on the DateField (the editor) and the > > Label/TextField (the renderer), but could never get something to work > > that would both display the Date and edit it in the correct format. I > > thought I was understanding which methods need to be modified, but I > > realize I'm not. Could someone please help me understand which > > methods need to be changed to allow for the data to be stored in > > milliseconds in the Array Collection, but be displayed and edited in > > the Date format? > > > > Thank you very much for any help, > > > > John > > > > >

