Array属性raw data object,不能保持同步,方式有限,Collection更好
Data provider分两种Linear和Hierarchical
Linear用IList ICollectionView操作,
Hierarchical用data descriptor来操作
Collection作为data provider时
更新可以立即可见,而不需要refresh
可以处理远程的data provider
single provider to multiple components
一些组件会自动的把Array转换成Collection
HttpServices, WebServices返回Array, RemoteObject返回ArrayCollection
Sort:
创建一个Sort对象,设置SortField, 设置Collection对象的Sort属性,refresh()
Filter:
创建一个单对象参数函数,返回Boolean值,设置Collection对象的filterFunction属性
IViewCursort:
设置
public var myCursor:IViewCursor;
myCursor=myAC.createCursor();
遍历
while (! myCursor.afterLast) {
myCursor.moveNext();
}
查找(绝对查找)
myCursor.findFirst("MZ");
myCursor.findFirst({label:"ME"})
myCursor.findFirst({label:"ME", data:"Augusta"});
相对查找seek()
Bookmarks
var myBookmark:CursorBookmark=myIViewCursor.bookmark;
myIViewCursor.seek(myBookmark);collection events:
实现IList, ICollectionView的类dispatch CollectionEvents,它们有itemUpdated来告诉Collections更新已经完成。
Listener为reservationsChanged,event的kind属性:ADD REMOVE, UPDATE, RESET
ICollectionView中用enableAutoUpdate()和disableAutoUpdate()来控制自动更新
[Bindable]可以加在类或属性前,则此类或属性改变时会产生propertyChange事件
Hierarchial Data Provider
两种:
XML: well-formed XML, XML, XMLList, XMLListCollection Object, <mx:XML>, <mx:XMLList>
Object: 具有children field的Object, <mx:Model>
<mx:XML>产生一个XML或XMLNode对象,默认为e4x格式,可设成xml
(好象<mx:XML>和<mx:XMLList>的不同在于,<mx:XML>后紧跟<root>)
An XMLList object is an ordered collection of properties. An XMLList object represents an XML document, an XML fragment, or an arbitrary collection of XML objects.
An XMLList object with one XML element is treated the same as an XML object. When there is one XML element, all methods that are available for the XML object are also available for the XMLList object.
用data descriptor来到处理
ITreeDataDescriptor处理tree
IMenuDataDescriptor处理Menu一类
当使用XML用data provider时,如果需要动态更新,则要转换成XMLListCollection:
<mx:XMLListCollection source="{XMLOBJECT.NODE}"/>
设成Tree的dataProvider时,需要设置labelField属性,showRoot属性可选
<mx:Tree dataProvider="{capitalColl}" labelField="@label" width="300"/>
如果Server端的类型为List,RemoteObejct返回ArrayCollection
public var ds:DataService;
[Bindable]
public var contacts:ArrayCollection = new ArrayCollection
ds = new DataService("ServiceName");
ds.fill(contacts);
不断获取的叫paged data,没有获取到的是pending data,这个机制用来缓解server和带宽压力
分享到:
相关推荐
动态填充DataGrid示例 博文链接:https://feiying-zone.iteye.com/blog/810267
tree多数情况下操作xml比较方便,而本人却对xml有些排斥,说得更确切些,对xml用的不是那么得心应手,所以选择了ArrayCollection
<DataGrid dataProvider="{ws.getProducts...}" /> <LineChart dataProvider"{ws.getProducts...}" /> A、 Application/WebService/Button/DataGrid/LineChart MXML组件 B、 id="ws" MXML 组件的id C、 click...
<mx:ColumnChart x="6" y="65" id="columnchart1" showDataTips="true" dataProvider="{list}" height="390" itemClick="onItemClick(event)"> 苹果" yField="apple" click="columnseries1_...
动态添加曲线条数 通过传递lablefild,和dataProvider的数组实现动态添加曲线
但是有一个问题就是在更新的时候都是发送整个datagrid的dataprovider中信息到数据库,无论有的资料并没有需要更新,这样处理起来效率就很低了。所在在高级篇中我想传递的数据只是用户更新的那部分。这样效率就会明显...
creationComplete="service.send()" > <![CDATA[ import mx.controls.Alert; import mx.rpc.events.FaultEvent;... import mx.collections.... dataProvider="{slides}"/> </mx:Application>
dataProvider="{loadingxml}" y="10" height="400" width="394" labelField="@label" itemClick="tree_itemClick(event);" itemOpening="tree_itemOpening(event);" > </lns:AsyncTree> ...
<mx:DataGrid id="dg1" dataProvider ="{dp}"> (data as Object)} " /> </mx:DataGridColumn> <mx:DataGridColumn headerText="names" dataField="names" width="200" /> ...
Design 视图:按钮,图片 Source 视图 MXML/ActionScript 3.0 动态效果:移动,旋转,放大,淡入...表格DataGrid, dataProvider,集合对象Array,ArrayCollection Http请求 HttpService, 报表:饼图,折线图,柱状图
快步进入flex门槛 1.效果-模糊化 ...<mx:DataGrid x="30" y="75" id="dgTopPosts" width="400" dataProvider="{wsBlogAggr.getMostPopularPosts.lastResult}"> 获取每行的值:DataGrid.selectedItem.postLink)
<mx:Tree id="tree" width="100%" height="100%" dataProvider="{content}" change="iFrame.source=tree.selectedNode.path" /> <![CDATA[ import mx.collections.ArrayCollection; //...
<mx:LinkBar dataProvider="{viewStack}" direction="horizontal" labelField="name" /> <mx:ViewStack id="viewStack" width="100%" height="75%" creationComplete="showData()" change="viewChanged(event)"> ...
1. a book Developing Flex Applications 2. a web page viewer for doc88 ebt 3. a DDA downloader for doc88.com CONTENTS PART I: Presenting Flex CHAPTER 1: Introducing Flex. . . . . . . . . . . . . . ...
纯as3.0写的Tree,完美支持xml,用法: <!-- 将非可视元素(例如服务、值对象)... itemRenderer="tasklib.component.UserTreeRenderer" labelField="@labels" dataProvider="{data}"> </component:UserTree>
1 , vb5dialog.zip This demonstrates how to subclass the Common Dialog Dialogs and manipulate a specific Dialog.<END><br>2 , cpnl.zip Form_Taskbar is a control for Visual Basic which, once placed...
体验.net2.0的优雅(四):Provider、策略、控制反转和依赖注入 泛型最佳实践 asp.net 2.0下嵌套masterpage页的可视化编辑 C# 2.0与泛型 动态调用对象的属性和方法——性能和灵活性兼备的方法 泛型技巧系列:用泛型...