Flex DataGrid 동적으로 Column 생성하기

Programming/Flex 2007.08.03 10:29 Posted by 파란크리스마스

출처
http://www.ihelpers.co.kr/programming/tipntech.php?CMD=view&TYPE=8&KEY=&SC=S&&CC=&PAGE=1&IDX=547

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="448">
  <mx:Script>
   import mx.controls.dataGridClasses.DataGridColumn;

    private function createColumn():void
    {
     var columns : Array = grid1.columns;
     var tmpCol :DataGridColumn =  new DataGridColumn();
     tmpCol.headerText = "Test";
     columns.push(tmpCol);
     
     grid1.columns = columns;
    }
  </mx:Script>
 
  <mx:DataGrid id="grid1" x="54" y="106" width="280" height="139"/>
 
  <mx:Button x="310" y="41" label="Button" click="{createColumn()}"/>
 
</mx:Application>

신고


 

티스토리 툴바