flex 中include应用例子以及高级DataGrid用法

下面红色部分为include引用外部as代码,蓝色部分为分组标签

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script> 
<![CDATA[  
import mx.collections.ArrayCollection; 
 include "HierarchicalDataForGroupedColumns.as";
]]>
</mx:Script>
 <mx:AdvancedDataGrid id="myADG"  width="100%" height="100%"  defaultLeafIcon="{null}">
  <mx:dataProvider> 
   <mx:HierarchicalData source="{dpHierarchy}"/> 
  </mx:dataProvider> 
  <mx:groupedColumns>  
  <mx:AdvancedDataGridColumn dataField="Region"/>  
  <mx:AdvancedDataGridColumn dataField="Territory"/>  
  <mx:AdvancedDataGridColumn dataField="Territory_Rep"    headerText="Territory Rep"/>  
  <mx:AdvancedDataGridColumnGroup dataField="Revenues">   
  <mx:AdvancedDataGridColumn dataField="Actual"/>   
  <mx:AdvancedDataGridColumn dataField="Estimate"/>
   <mx:AdvancedDataGridColumn dataField="Territory_Rep"/> 
    <mx:AdvancedDataGridColumn dataField="Territory"/>   
  </mx:AdvancedDataGridColumnGroup> 
  </mx:groupedColumns>
  </mx:AdvancedDataGrid></mx:Application>

下面代码为HierarchicalDataForGroupedColumns.as文件中的代码,注意此文件建立的是as文件而不是as类文件。

[Bindable]
public var dpHierarchy:ArrayCollection = new ArrayCollection([ {Region:"Southwest", Territory:"Arizona",  Territory_Rep:"Barbara Jennings",  Revenues:{Actual:38865, Estimate:40000,Territory_Rep:"Barbara Jennings",Territory:"Arizona"}},
                 {Region:"Southwest", Territory:"Arizona",  Territory_Rep:"Dana Binn",  Revenues:{Actual:29885, Estimate:30000,Territory_Rep:"Barbara Jennings",Territory:"Arizona"}},
                 {Region:"Southwest", Territory:"Central California",  Territory_Rep:"Joe Smith",  Revenues:{Actual:29134, Estimate:30000,Territory_Rep:"Barbara Jennings",Territory:"Arizona"}},
                 {Region:"Southwest", Territory:"Nevada",  Territory_Rep:"Bethany Pittman",  Revenues:{Actual:52888, Estimate:45000,Territory_Rep:"Barbara Jennings",Territory:"Arizona"}},
                 {Region:"Southwest", Territory:"Northern California",  Territory_Rep:"Lauren Ipsum",  Revenues:{Actual:38805, Estimate:40000,Territory_Rep:"Barbara Jennings",Territory:"Arizona"}},
                 {Region:"Southwest", Territory:"Northern California",  Territory_Rep:"T.R. Smith",  Revenues:{Actual:55498, Estimate:40000,Territory_Rep:"Barbara Jennings",Territory:"Arizona"}},
                 {Region:"Southwest", Territory:"Southern California",  Territory_Rep:"Alice Treu",  Revenues:{Actual:44985, Estimate:45000,Territory_Rep:"Barbara Jennings",Territory:"Arizona"}},
                 {Region:"Southwest", Territory:"Southern California",  Territory_Rep:"Jane Grove",  Revenues:{Actual:44913, Estimate:45000,Territory_Rep:"Barbara Jennings",Territory:"Arizona"}}]);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值