- 浏览: 1558287 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (571)
- Flex (301)
- AIR (5)
- ComPiere (8)
- ExtJS (15)
- SAP (0)
- jBPM (3)
- Java-Hibernate (5)
- Java-Spring (10)
- XML (2)
- java-web (30)
- db2 (2)
- websphere (4)
- Google (5)
- 虚拟机 (10)
- eclipse (8)
- Win2003 (11)
- Ubuntu (27)
- VMware (4)
- CentOS (3)
- JSON (1)
- Oracle (15)
- SilverLight (1)
- 大事记 (6)
- VirtualBox (5)
- Solaris (10)
- AIX (6)
- 云计算 (10)
- MacOS (4)
- iOS (1)
- SQLite (1)
- Activiti (1)
- jdk (5)
- hadoop (8)
- Ant (4)
- PhoneGap (2)
- JavaScript (11)
- jQuery (1)
- FireFox (1)
- HBase (2)
- sqoop (0)
- ffmpeg (7)
- mencode (0)
- jdbc (1)
- SQLServer (1)
- 组件平台 (12)
- struts2 (4)
- intellj (4)
- android (1)
- ExtJS4 (1)
- 色卡司 (1)
- Linux (3)
- ExtJS5 (1)
- zookeeper (2)
- maven (1)
- Java (6)
- vpn (0)
- squid (1)
- MySQL (2)
- webpackage (1)
- antd (1)
- lucene (1)
最新评论
-
qq_24800465:
请问这里的库从哪下载啊
ffmpeg所有的编码器(encoders) -
neusoft_jerry:
貌似这里没用到StreamingAMFChannel哦,只是用 ...
Flex BlazeDS 推送技术 -
anyone:
感谢你的博文,看了受益匪浅
记住这个IntelliJ IDEA的编译设置 -
keren:
现在还有什么应用需要用flex来开发的?
flex tree的展开,关闭,添加、删除子节点 -
neusoft_jerry:
简洁明快,好贴好贴!楼主V5!
flex tree的展开,关闭,添加、删除子节点
显示服务器端大量数据之效能贴士 Performance Tips for Displaying Large Volume of Data from Server
- 博客分类:
- Flex
http://riashanghai.com/zh-hant/node/97
当需要显示从服务器端传来的大量数据的时候, 我们可以使用DataGrid datagrid为UI, 其data provider 为一个ArrayCollection:
var datagrid:DataGrid = new DataGrid();
datagrid.dataprovider = new ArraryCollection();
服务器传过来海量数据时我们可以这样来做:
for each object { // replace 'for each object' with your own real code
ArrayCollection(datagrid.dataprovider).addItem(object);
}
从效能角度来说, 上面的代码是有问题的 - 每一个addItem呼叫后datagrid将进行一次刷新, AS可以在一秒钟执行上万个addItem操作, 但执行一万次刷新则花费很多时间. 有两个解决方案:
方法一: 使用ArrayCollection.disableAutoUpdate():
ArrayCollection(datagrid.dataprovider).disableAutoUpdate():
for each object {
ArrayCollection(datagrid.dataprovider).addItem(object);
}
ArrayCollection(datagrid.dataprovider).enableAutoUpdate();
这样即便上万个addItem操作, 刷新仅有一次.
注意: disableAutoUpdate/enableAutoUpdate必须成对呼叫 - 若呼叫两次disableAutoUpdate, 再呼叫一次enableAutoUpdate, 这时不会有刷新; 你必须呼叫第二次enableAutoUpdate.
方法二: 将数据预先放到一个ArrayCollection里面, 然后将其set为dataprovider的list. 如果这样, dataprovider就不必为ArrayCollection了, 而是ListCollectionView:
datagrid.dataprovider = new ListCollectionView();
var myAC:ArrayCollection = new ArrayCollection();
for each object {
myAC.addItem(object);
}
ListCollectionView(datagrid.dataprovider).list = myAC;
这样刷新也仅有一次.
方法一适用于dataprovider是自定义的class(一般extends ArrayCollection), 其实disableAutoUpdate(),enableAutoUpdate()及数据操作完全可以在这个自定义class里面执行;
方法二适用于较为简单的情况;
不必使用方法一或者方法二的情况: 当所需要操作的ArrayCollection并没有任何Event Listener的时候, 我们不必考虑其产生的Event. 一个ArrayCollection被设为DataGrid的dataprovider的时候, DataGrid会add event listener到ArrayCollection上, 这就要面对上面所提到的效能考量了.
当需要显示从服务器端传来的大量数据的时候, 我们可以使用DataGrid datagrid为UI, 其data provider 为一个ArrayCollection:
var datagrid:DataGrid = new DataGrid();
datagrid.dataprovider = new ArraryCollection();
服务器传过来海量数据时我们可以这样来做:
for each object { // replace 'for each object' with your own real code
ArrayCollection(datagrid.dataprovider).addItem(object);
}
从效能角度来说, 上面的代码是有问题的 - 每一个addItem呼叫后datagrid将进行一次刷新, AS可以在一秒钟执行上万个addItem操作, 但执行一万次刷新则花费很多时间. 有两个解决方案:
方法一: 使用ArrayCollection.disableAutoUpdate():
ArrayCollection(datagrid.dataprovider).disableAutoUpdate():
for each object {
ArrayCollection(datagrid.dataprovider).addItem(object);
}
ArrayCollection(datagrid.dataprovider).enableAutoUpdate();
这样即便上万个addItem操作, 刷新仅有一次.
注意: disableAutoUpdate/enableAutoUpdate必须成对呼叫 - 若呼叫两次disableAutoUpdate, 再呼叫一次enableAutoUpdate, 这时不会有刷新; 你必须呼叫第二次enableAutoUpdate.
方法二: 将数据预先放到一个ArrayCollection里面, 然后将其set为dataprovider的list. 如果这样, dataprovider就不必为ArrayCollection了, 而是ListCollectionView:
datagrid.dataprovider = new ListCollectionView();
var myAC:ArrayCollection = new ArrayCollection();
for each object {
myAC.addItem(object);
}
ListCollectionView(datagrid.dataprovider).list = myAC;
这样刷新也仅有一次.
方法一适用于dataprovider是自定义的class(一般extends ArrayCollection), 其实disableAutoUpdate(),enableAutoUpdate()及数据操作完全可以在这个自定义class里面执行;
方法二适用于较为简单的情况;
不必使用方法一或者方法二的情况: 当所需要操作的ArrayCollection并没有任何Event Listener的时候, 我们不必考虑其产生的Event. 一个ArrayCollection被设为DataGrid的dataprovider的时候, DataGrid会add event listener到ArrayCollection上, 这就要面对上面所提到的效能考量了.
发表评论
-
extjs结合flex(flash)的注意事项.
2014-01-02 17:11 2393//for fix bug //flash里使 ... -
flash(flex)crossdomain dtd规范
2013-12-27 13:38 946dtd文件位置: http://www.macromedia. ... -
flash内嵌在html里面的代码
2013-12-27 09:19 1188<!-- 除IE外都可识别 --> < ... -
FlashBuilder4.5 ADT命令详解(官方)
2011-12-16 17:45 1246http://help.adobe.com/en_US/air ... -
FlashBuilder4.5加入ADT插件
2011-12-16 17:24 1806参考: http://renaun.com/blog/2011 ... -
Flex as3commons log的简单使用
2011-11-28 20:26 1590http://www.as3commons.org/ &l ... -
Flex日志工具汇总
2011-11-27 16:29 1240巨兽 monster [能调试 mobile和web air] ... -
【转】[Flex]我经常使用的Flex Tools 和 Resource
2011-11-22 08:36 1303http://www.k-zone.cn/zblog/post ... -
[转]Flex Socket安全策略<policy-file-request/>及应对方法
2011-08-27 16:43 1724http://hi.baidu.com/dobodo/blog ... -
flash 安全策略文件
2011-08-27 16:31 2144<?xml version="1.0&qu ... -
Request请求头的格式
2011-08-27 15:38 2354每次提交http请求时,请求头是什么样的的格式呢? GET方 ... -
flash Tooltip类
2011-08-27 15:06 1130http://www.flepstudio.com/flash ... -
flash SQLite包装类
2011-08-27 15:00 2227[转]http://www.flepstudio.com/fl ... -
[转](原创)flex解决跨域问题的策略文件的写法
2011-08-04 09:59 1552http://hi.baidu.com/wosinmaiken ... -
[转](整理)flex常用验证控件
2011-08-04 08:30 1374http://hi.baidu.com/wosinmaiken ... -
Flex4.5 skin组建皮肤的应用
2011-07-28 08:52 2811http://www.iyoya.com/2011/06/04 ... -
如何成为一个合格的iOS开发者?
2011-07-17 14:59 1338转:http://www.adobe.com/cn/devne ... -
flex4.5移动设备开发-添加应用背景图片
2011-07-17 10:50 2289【转】http://spy6.blogspot.com/201 ... -
flex4.5移动设备开发-应用访问权限设置
2011-07-16 14:19 1356在构建flex4.5 mobile application的时 ... -
flex4.5移动设备开发-表格效果
2011-07-15 23:12 1799做了个实验,没想到做出表格的效果
相关推荐
Configuration Examples for Displaying CPU Usage of the Device Using SNMP
Fast zoom function for displaying data from annual, monthly or weekly overview down to a millisecond range Combined display of current and historical data within one application Recording and display ...
approach a graph from a visual perspective, thinking about how each component of the data is represented on the final plot This book will be useful to everyone who has struggled with displaying data ...
Python Data Visualization Cookbook will progress the reader from the point of installing and setting up a Python environment for data manipulation and visualization all the way to 3D animations using ...
for the addition of data extracted from the Internet. We address the issues of asynchronous data processing. – Part 3: This is dedicated to deploying applications: - accessing open data, free data, ...
displaying spatial-temporal displays with Google Earth, and generating code from descriptions of data structures to read and write data. These topics demonstrate the rich possibilities and ...
Displaying time series, spatial, and space-time data with R R语言画图,介绍了ggplot2,lattice包的画图功能,以及空间数据可视化
To display the numeric editing environment for editing a field containing numeric content from the data or use it solely for displaying and without changing data. TDBSumList: To count the total and ...
Displaying Data on a PC tinyos
Simple java library for displaying dates as relative time
Among the multitude of topics addressed, it shows you techniques for: <br>Using Ajax with Google Maps and Yahoo Maps <br>Displaying Weather.com data<br> Scraping stock quotes <br>Fetching...
Table of Contents * Here We Go Round Again * Core Data The What, Why & How * A Super Start: Adding, Displaying, and Deleting Data * The Devil in the Detail View * Preparing for Change: Migrations and...
Using Edit box as static Text Control for displaying ToolTip。
Check out this article for displaying large bitmaps into the desired area of your dialog box in its original size with a scrolling technique used to show the entire bitmap. 滚动显示位图 在VC++环境下...
Many SQL texts attempt to ...Chapter 20 Strategies for Displaying Data Appendix A: Getting Started with Microsoft SQL Server Appendix B: Getting Started with MySQL Appendix C: Getting Started with Oracle
Master efficient UI strategies for displaying data, while accounting for threading issues Use Android’s Intents API to pass data between activities when starting a new activity or service Achieve two...
You've got data to communicate. But what kind of visualization do you choose, how do you build it, and how do you ensure that it's up to the demands of the Web? In Data Visualization with JavaScript,...
Table of Contents •Determining Whether the Device Is Ready •Retrieving Information About the Device •Creating a Persistent Navigation System •Detecting the Device’s Network Status •...
Power Data Recovery数据恢复 Copyright(c) 2006-2009 MT Solution Ltd., All rights reserved. END-USER LICENSE AGREEMENT IMPORTANT-READ CAREFULLY: This End-User License Agreement ("EULA") is a legal ...