Flex labelFunction 用法
<mx:VBox horizontalAlign="left" height="100%" width="100%"> <mx:Canvas id="cavApproverList" width="100%" height="100%"> <mx:VBox id="boxApp" top="2" width="100%" height="100%" left="2" right="2" bottom="2" > <mx:DataGrid id="expenseItemADG" selectable="false" dataProvider="{approverList}" rowCount="7" sortableColumns="false"> <mx:columns> <mx:DataGridColumn dataField="StepOrder" headerText="" width="20" /> <mx:DataGridColumn dataField="ApproverName" headerText="Name" width="200" sortable="false" /> <mx:DataGridColumn dataField="ApproverGrade" headerText="Grade" width="200" sortable="false" /> <mx:DataGridColumn dataField="ApprovedDate" headerText="Status" width="300" sortable="false" labelFunction="StatuFunction" /> </mx:columns> </mx:DataGrid> </mx:VBox> </mx:Canvas> </mx:VBox>
public function StatuFunction(item:Object, column:DataGridColumn):String { var df:DateFormatter = new DateFormatter(); df.formatString = "YYYY-MM-DD JJ:NN:SS"; var value:String = "Approved at " + df.format(item.ApprovedDate).toString(); return value; }