flex DataGrid에서 컬럼 포맷 바꾸기
출처 :http://cafe.naver.com/flexcomponent/4608
[DataGrid에 전화번호Format 설정하기]
import mx.formatters.SwitchSymbolFormatter;
private var sf:SwitchSymbolFormatter;
private function ssnLabelFunction(item:Object, column:DataGridColumn):String {
if (!sf) {
sf = new SwitchSymbolFormatter();
}
return sf.formatValue("###-##-####", item["SS_NUMBER"]);
}
//Then inside the DataGridColumn we can mention this function name:
<mx:DataGridColumn dataField="SS_NUMBER" labelFunction="ssnLabelFunction" />
[ DataGrid에 dateFormat 설정하기 ]
<mx:DateFormatter id="publishDate" formatString="MMMM DD, YYYY" />
private function dateFormat(dateItem:Object, publish_date:DataGridColumn):String{
return publishDate.format(dateItem.publish_date);
}
<mx:DataGrid x="56" y="250" width="950" dataProvider="{bookStock}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="book name"/>
<mx:DataGridColumn dataField="publish_date" headerText="Publication Date" labelFunction="dateFormat" />
</mx:columns>
</mx:DataGrid>
==================================================================
없는거 같아서 올립니다....
labelFunction 를 이용한 여러가지 방법입니다. 참고하세요'WebPrograming관련 > Adobe Flex' 카테고리의 다른 글
dataProvider in flex (0) | 2007.08.10 |
---|---|
flex 연습중 찾은 글들. (0) | 2007.08.10 |
flex DataGrid에서 itemRenderer를 사용하면서의 경험 (0) | 2007.08.10 |