• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Flex中AdvancedDataGrid的用法示例介绍

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
AdvancedDataGrid实现双表头表格

(1)源码

AdvanceGrid.mxml
复制代码 代码如下:

<?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"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout verticalAlign="middle" horizontalAlign="center"/>
</s:layout>
<fx:Declarations>

</fx:Declarations>

<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
.adv{
font-size:12;
font-weight:bold;
color:FFFFFF;
}
</fx:Style>

<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;

[Bindable]
private var flatArray:ArrayCollection = new ArrayCollection([
{school:"星艺高中",one:"5645",two:"4512",three:"4545",man:"8656",woman:"6545",Chinese:"98",Maths:"78",English:"98"},
{school:"充实高中",one:"5665",two:"4512",three:"6563",man:"8565",woman:"6541",Chinese:"67",Maths:"86",English:"65"},
{school:"理论一中",one:"6545",two:"6562",three:"5623",man:"8754",woman:"6214",Chinese:"87",Maths:"78",English:"86"},
{school:"护名高中",one:"5623",two:"2356",three:"4512",man:"8574",woman:"6354",Chinese:"98",Maths:"84",English:"69"},
{school:"竹艺高中",one:"4545",two:"7545",three:"5623",man:"8547",woman:"6352",Chinese:"94",Maths:"80",English:"87"},
{school:"精髓高中",one:"6565",two:"4512",three:"4512",man:"8354",woman:"6854",Chinese:"90",Maths:"68",English:"97"}
]);
]]>
</fx:Script>

<mx:VBox width="100%" height="100%" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10">
<mx:AdvancedDataGrid id="adg" dataProvider="{flatArray}" designViewDataType="flat" width="100%" height="100%"
paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" verticalAlign="middle"
textAlign="center" headerSeparatorSkin="mx.skins.ProgrammaticSkin" headerColors="[0xB0C4DE,0xB0C4DE]"
headerStyleName="adv">
<mx:groupedColumns>
<mx:AdvancedDataGridColumn headerText="学校" dataField="school"/>
<mx:AdvancedDataGridColumnGroup headerText="班级">
<mx:AdvancedDataGridColumn headerText="高一" dataField="one"/>
<mx:AdvancedDataGridColumn headerText="高二" dataField="two"/>
<mx:AdvancedDataGridColumn headerText="高三" dataField="three"/>
</mx:AdvancedDataGridColumnGroup>
<mx:AdvancedDataGridColumnGroup headerText="性别">
<mx:AdvancedDataGridColumn headerText="男" dataField="man"/>
<mx:AdvancedDataGridColumn headerText="女" dataField="woman"/>
</mx:AdvancedDataGridColumnGroup>
<mx:AdvancedDataGridColumnGroup headerText="课程">
<mx:AdvancedDataGridColumn headerText="语文" dataField="Chinese"/>
<mx:AdvancedDataGridColumn headerText="数学" dataField="Maths"/>
<mx:AdvancedDataGridColumn headerText="英语" dataField="English"/>
</mx:AdvancedDataGridColumnGroup>
</mx:groupedColumns>
</mx:AdvancedDataGrid>
</mx:VBox>

</s:Application>

(2)显示结果

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Flex中的HDividedBox和VDividedBox的比较附图发布时间:2022-02-05
下一篇:
FLEX给页面添加滚动条实现思路及代码发布时间:2022-02-05
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap