Flex Advanced DataGrid 레이 어 링 디 스 플레이

AdvancedDataGrid 는 실제 증강 판 DataGrid 로 더욱 강력 한 맞 춤 형 디 스 플레이 기능 을 제공 합 니 다.
 
1. 트 리 구조 로 데 이 터 를 표시 합 니 다.
 
 
 

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="application1_creationCompleteHandler(event)">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.collections.HierarchicalData;
			import mx.events.FlexEvent;
			
			//children array,  DataGrid     
			public var dp:ArrayCollection = new ArrayCollection([
				{name:"jobs",email:"[email protected]",children:[{name:"tom",email:"[email protected]"}]}
				,{name:"marry",email:"[email protected]"}
			]);
			
			protected function application1_creationCompleteHandler(event:FlexEvent):void
			{
				// TODO Auto-generated method stub
			
				var fd:HierarchicalData = new HierarchicalData;
				fd.source = dp;
				dd.dataProvider = fd;
				
			}

		]]>
	</fx:Script>
	<fx:Declarations>
		<!--       (    、   )     -->
	</fx:Declarations>
	
	<mx:AdvancedDataGrid id="dd">
		<mx:columns>
			<mx:AdvancedDataGridColumn dataField="name" headerText="  ">
				
			</mx:AdvancedDataGridColumn>
			<mx:AdvancedDataGridColumn dataField="email" headerText="  ">
				
			</mx:AdvancedDataGridColumn>
		</mx:columns>
	</mx:AdvancedDataGrid>
</s:Application>

 2. 또는 데 이 터 를 동적 으로 얻 을 수 있 습 니 다. 데 이 터 를 이렇게 조합 할 수 있 습 니 다.
 
 


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="application1_creationCompleteHandler(event)">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.collections.HierarchicalData;
			import mx.events.FlexEvent;
			
			//children array,  DataGrid     
			public var dp:ArrayCollection = new ArrayCollection([
				{name:"dd",email:"[email protected]"}
				,{name:"lp",email:"[email protected]"}
			]);
			
			protected function application1_creationCompleteHandler(event:FlexEvent):void
			{
				// TODO Auto-generated method stub
			
				var childrens:Array = new Array();
				childrens.push({name:"ddlp",email:"[email protected]"});
				
				dp.getItemAt(0).children = childrens;   //children       
				
				var fd:HierarchicalData = new HierarchicalData;
				fd.source = dp;
				dd.dataProvider = fd;
				
			}

		]]>
	</fx:Script>
	<fx:Declarations>
		<!--       (    、   )     -->
	</fx:Declarations>
	
	<mx:AdvancedDataGrid id="dd">
		<mx:columns>
			<mx:AdvancedDataGridColumn dataField="name" headerText="  ">
				
			</mx:AdvancedDataGridColumn>
			<mx:AdvancedDataGridColumn dataField="email" headerText="  ">
				
			</mx:AdvancedDataGridColumn>
		</mx:columns>
	</mx:AdvancedDataGrid>
</s:Application>

좋은 웹페이지 즐겨찾기