Flex基础-----之DataProvider

一、

<?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">
 <fx:Declarations>
  <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 </fx:Declarations>
 <fx:Script>
  <![CDATA[
   import mx.collections.ArrayCollection;
   import mx.utils.UIDUtil;
   
   [Bindable]
   private var data:ArrayCollection=new ArrayCollection([
    {mx_internal_uid:UIDUtil.createUID(),userid:"a1",useridname:"张三"},
    {mx_internal_uid:UIDUtil.createUID(),userid:"a2",useridname:"李四"}, 
    {mx_internal_uid:UIDUtil.createUID(),userid:"a6",useridname:"路人乙"} ]);
  ]]>
 </fx:Script>
 <s:DataGrid name="dg_list" width="600" requestedRowCount="2" dataProvider="{data}" horizontalCenter="0" y="200" >
  <s:columns>
   <s:ArrayList>
    <s:GridColumn datafield="mx_internal_uid" headerText="列 1"></s:GridColumn>
    <s:GridColumn datafield="userid" headerText="列 2"></s:GridColumn>
    <s:GridColumn datafield="useridname" headerText="列 3"></s:GridColumn>
   </s:ArrayList>
  </s:columns>
 </s:DataGrid>
</s:Application>

二、

<?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">
 <fx:Declarations>
  <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 </fx:Declarations>
 <s:DataGrid id="dataGrid" width="600" requestedRowCount="5" horizontalCenter="0" y="200">
  <s:ArrayCollection>
   <s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/>
   <s:DataItem key="1001" name="Brush" price="110.01" call="true"/>
   <s:DataItem key="1002" name="Clamp" price="120.02" call="false"/>
   <s:DataItem key="1003" name="Drill" price="130.03" call="true"/>
   <s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/>
   <s:DataItem key="1005" name="File" price="150.05" call="true"/>
   <s:DataItem key="1006" name="Gouge" price="160.06" call="false"/>
   <s:DataItem key="1007" name="Hook" price="170.07" call="true"/>
   <s:DataItem key="1008" name="Ink" price="180.08" call="false"/>
   <s:DataItem key="1009" name="Jack" price="190.09" call="true"/>            
  </s:ArrayCollection>
 </s:DataGrid>
</s:Application>

参考:

http://bbs.csdn.net/topics/390159047

http://bbs.9ria.com/thread-131489-1-1.html

http://www.voidcn.com/article/p-rcqwdvni-mo.html

http://yunzhongxia.iteye.com/blog/1133301

相关文章

一:display:flex布局display:flex是一种布局方式。它即可以...
1. flex设置元素垂直居中对齐在之前的一篇文章中记载过如何...
移动端开发知识点pc端软件和移动端apppc端软件是什么,有哪些...
最近挺忙的,准备考试,还有其他的事,没时间研究东西,快周...
display:flex;把容器设置为弹性盒模型(设置为弹性盒模型之后...
我在网页上运行了一个Flex应用程序,我想使用Command←组合键...