• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 10496
  • Last Modified:

Flex Data grid format coloum as date

I was wondering in the flex data grid how would i format a column MM/DD/YY  
0
stargateatlantis
Asked:
stargateatlantis
1 Solution
 
Gary BenadeCommented:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
	<mx:Script>
		<![CDATA[
			import mx.controls.dataGridClasses.DataGridColumn;
			import mx.controls.DataGrid;
			
			[Bindable] private var ds:Array = new Array(
			{theDate: new Date()},
			{theDate: new Date()});
			
			
			private function dateFunc( item:Object, column:DataGridColumn):String
			{
				return df.format( item.theDate);
			}
		]]>
	</mx:Script>
	<mx:DateFormatter id="df" formatString="MM/DD/YY"/>
	<mx:DataGrid x="39" y="10" width="575" height="420" dataProvider="{ds}">
		<mx:columns>
			<mx:DataGridColumn headerText="date" dataField="theDate" labelFunction="dateFunc" />
		</mx:columns>
	</mx:DataGrid>	
</mx:Application>

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now