-
1. Re: Date divided into Date and Time in DataGrid But get errors on Time
Michelle5002 May 6, 2011 10:29 AM (in response to Michelle5002)Not sure this is the best way but it worked. See Below for Code
-
2. Re: Date divided into Date and Time in DataGrid But get errors on Time
Michelle5002 May 6, 2011 10:29 AM (in response to Michelle5002)<mx:DataGridColumn id="startDateDC" headerText="Start Date" dataField="startDate" width="100"
labelFunction="dateTimeFormat" editorDataField="value">
<mx:itemEditor>
<fx:Component>
<mx:Canvas width="100%">
<fx:Declarations>
<mx:DateFormatter id="timeFormatter" formatString="L:NN A"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:HGroup width="100%"><fx:Script>
<![CDATA[
protected function timeFormat(date:Date):String
{
return timeFormatter.format(date);
}public function get value():Date
{
var date:Date = new Date(dateField.selectedDate.toDateString() + " " + timeField.text);
return date;
}
]]>
</fx:Script>
<mx:DateField id="dateField" editable="true" width="50%"
formatString="MM-DD-YYYY"
selectedDate="{outerDocument.nonAvailDg.selectedItem.startDate}"/>
<mx:TextInput id = "timeField" editable="true" width="50%"
data="{timeFormat(outerDocument.nonAvailDg.selectedItem.startDate)}"/>
</s:HGroup>
</mx:Canvas>
</fx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
