반응형

출처 :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 를 이용한 여러가지 방법입니다. 참고하세요
반응형
Posted by Real_G