在FLEX4中创建复杂数据源(一)
来源:互联网 发布:mac pro 2016 发布时间 编辑:程序博客网 时间:2024/06/05 02:39
第一种方式:
<mx:DataGrid id="dg" horizontalCenter="0" verticalCenter="0">
<mx:columns>
<mx:DataGridColumn dataField="firstName" />
<mx:DataGridColumn dataField="lastName" />
<mx:DataGridColumn dataField="address.town" />
<mx:DataGridColumn dataField="address.state" />
<mx:DataGridColumn dataField="address.zipCode" />
</mx:columns>
<mx:dataProvider>
<mx:ArrayCollection>
<fx:Object firstName="Carol" lastName="F.">
<fx:address>
<fx:Object town="Waltham" state="MA" zipCode="02452" />
</fx:address>
</fx:Object>
<fx:Object firstName="Darrell" lastName="L.">
<fx:address>
<fx:Object town="Waltham" state="MA" zipCode="02452" />
</fx:address>
</fx:Object>
<fx:Object firstName="Hans" lastName="M.">
<fx:address>
<fx:Object town="San Francisco" state="CA" zipCode="94103" />
</fx:address>
</fx:Object>
<fx:Object firstName="Kevin" lastName="L.">
<fx:address>
<fx:Object town="San Francisco" state="CA" zipCode="94103" />
</fx:address>
</fx:Object>
</mx:ArrayCollection>
</mx:dataProvider>
</mx:DataGrid>
第二种方式:
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.DataGrid;
import mx.controls.dataGridClasses.DataGridColumn;
protected var dg:DataGrid;
protected function init():void {
var cols:Array = [];
cols.push(new DataGridColumn("firstName"));
cols.push(new DataGridColumn("lastName"));
cols.push(new DataGridColumn("address.town"));
cols.push(new DataGridColumn("address.state"));
cols.push(new DataGridColumn("address.zipCode"));
var arr:Array = [];
arr.push({firstName:"Carol", lastName:"F.", address:{town:"Waltham", state:"MA", zipCode:"02452"}});
arr.push({firstName:"Darrell", lastName:"L.", address:{town:"Waltham", state:"MA", zipCode:"02452"}});
arr.push({firstName:"Hans", lastName:"M.", address:{town:"San Francisco", state:"CA", zipCode:"94103"}});
arr.push({firstName:"Kevin", lastName:"L.", address:{town:"San Francisco", state:"CA", zipCode:"94103"}});
dg = new DataGrid();
dg.columns = cols;
dg.dataProvider = new ArrayCollection(arr);;
dg.horizontalCenter = dg.verticalCenter = 0;
addElement(dg);
}
]]>
</fx:Script>
- 在FLEX4中创建复杂数据源(一)
- 再flex4中创建复杂数据源(二)
- 在Windows中创建Sybase数据源
- 在Flex4中嵌入字体
- FLEX实践—FLEX4中Theme Halo应用(一)
- flex4中自定义itemRenderer呈现器(一)
- flex4:中DataGroup组件获取数据源(ArrayCollection方式)实例
- 在visual studio 中创建水晶报表并连接数据源(C#)
- 在C++Builder中创建Access odbc数据源
- 在SharePoint 2010中通过SQL数据源创建仪表板
- 在SharePoint 2010中通过SQL数据源创建仪表板
- MyEclipse数据库教程:在WebSphere中创建数据源
- 在 Linux 中创建 KingbaseES 的 ODBC 数据源
- 使用easyUI在panel中创建复杂布局
- flex4 中创建自定义弹出窗口
- flex4中创建竖向显示的button
- Flex4.0学习(一)
- 一分钟学会在JavaWeb项目中配置数据源
- 在Linux中创建静态库和动态库
- jsp中forward方法与sendRedirect方法的区别
- Change the BLACK background of datawindow on column moving and mouse selection
- 传智播客---文件上传下载系统
- equals ==
- 在FLEX4中创建复杂数据源(一)
- 使用jquery构造自己的多级菜单
- 找出一个数组中不存在于另一个数组中的元素
- 再flex4中创建复杂数据源(二)
- μC/OS II 任务调度详解(一)
- 窗口(window)特点
- struts2.0 整合tiles 配置
- 23种设计模式总结
- Android如何生成设备节点