2008-07-23
解决Ext对于复杂项目加载慢的一个思路
关键字: ext.ux.plugin.remotecomponent
本人新手,以下仅仅是个人观点:
OPOJ方式下使用Ext,由于在第一次加载时,加载了太多了js,导致加载时间过长。
加速加载js库大概有如下几个方法(非网络因素):
1、硬件:用更好的cpu,更高的内存
2、软件:使用对ext支持更好的os和浏览器
3、各个浏览器窗口共享js对象而不是js文件
4、实现单页面按需加载js
方法1、2都不是开发者所直接能控制的。
目前来说对于子页面不能共享父页面的ext库,虽然一般他们用的js文件是相同的。
所以目前来说方法3可能行不通。
传统web方式下,各个页面使用自己的js(量比较少)。
由于ext库本身巨大(不是代码量,应该是对象数和对象的复杂程度),使用单页面的好处也很明显(不是单js,通常单js是为了网络传输,但是对于传输后浏览器加载来说,几乎没有区别)。
同时我们一般用tab来划分业务,目前部分ext users使用tab+iframe来实现多页面的应用。这样就可以将各个业务使用的非通用的js区别来,各自在使用时加载到独立的页面,其实还是传统的方式。
考虑到目前已经有很多js库使用按需加载的方式来管理js文件和对象。可以从这个方面出来,利用方法4来实现大型js库的提速。由于本人能力有限,只是想法而已。
最后,提供一个有点关系的extend:总的来说,就是通过一个url来动态的加载所需的js脚本来创建js组件。
大家可以直接看例子。个人觉得还是太粗糙,期盼牛人们实现一个功能更完善,设计更好的extend。这样,ext向前发展的轮子应该可以走的更远、应用范围也会更广。
http://extjs.com/forum/showthread.php?t=18023
-------------------
ExtJS - Plugin - RemoteComponent / LiteRemoteComponent - Demo
Plugin for ExtJS Ext.Container / Ext.Toolbar Elements to dynamically add Components
from a remote / AJAX source to the Element's body.
author: Timo Michna / matikom
* Loads configuration as JSON-String from a remote / AJAX source.
* Adds the Components to the Container body.
* Additionally to its own config options the class accepts all the configuration options
required to configure its internal Ext.Ajax.request().
* The RemoteComponent consists of the lightweight Ext.ux.Plugin.LiteRemoteComponent class and
the more configurable Ext.ux.Plugin.RemoteComponent which extends Ext.util.Observable.
Ext.ux.Plugin.RemoteComponent:
* Several events, which can be used to stop further processing by returning false.
* Processing can also be stopped by config option breakOn at any of the plugins events.
* AJAX requests to the remote source can be defered by config option loadOn to any event of the container. Usefull for lazy loading etc.
* LiteRemoteComponent and RemoteComponent - Plugins can be nested. So a Plugin can load and create Components, which also have (a) RemoteComponent - Plugin(s)
Where to use:
You can use the plugin with any Component with
plugin ability - this is Ext.Container, Ext.Toolbar
and every Component derived from both of them.
For example: TabPanel, Tip, Window, FieldSet, FormPanel,
GridPanel, TreePanel, PagingToolbar, etc.
What to use for?
This is a very small but powerfull plugin. use it for:
- lazy loading of components
- provide different views of components per request
- remote Forms
- cascade component views based on server side authentification
- testing of component configuration. Don´t reload the document,
destroy and reopen a component with a RemoteComponent plugin.
- and many more
OPOJ方式下使用Ext,由于在第一次加载时,加载了太多了js,导致加载时间过长。
加速加载js库大概有如下几个方法(非网络因素):
1、硬件:用更好的cpu,更高的内存
2、软件:使用对ext支持更好的os和浏览器
3、各个浏览器窗口共享js对象而不是js文件
4、实现单页面按需加载js
方法1、2都不是开发者所直接能控制的。
目前来说对于子页面不能共享父页面的ext库,虽然一般他们用的js文件是相同的。
所以目前来说方法3可能行不通。
传统web方式下,各个页面使用自己的js(量比较少)。
由于ext库本身巨大(不是代码量,应该是对象数和对象的复杂程度),使用单页面的好处也很明显(不是单js,通常单js是为了网络传输,但是对于传输后浏览器加载来说,几乎没有区别)。
同时我们一般用tab来划分业务,目前部分ext users使用tab+iframe来实现多页面的应用。这样就可以将各个业务使用的非通用的js区别来,各自在使用时加载到独立的页面,其实还是传统的方式。
考虑到目前已经有很多js库使用按需加载的方式来管理js文件和对象。可以从这个方面出来,利用方法4来实现大型js库的提速。由于本人能力有限,只是想法而已。
最后,提供一个有点关系的extend:总的来说,就是通过一个url来动态的加载所需的js脚本来创建js组件。
大家可以直接看例子。个人觉得还是太粗糙,期盼牛人们实现一个功能更完善,设计更好的extend。这样,ext向前发展的轮子应该可以走的更远、应用范围也会更广。
http://extjs.com/forum/showthread.php?t=18023
-------------------
ExtJS - Plugin - RemoteComponent / LiteRemoteComponent - Demo
Plugin for ExtJS Ext.Container / Ext.Toolbar Elements to dynamically add Components
from a remote / AJAX source to the Element's body.
author: Timo Michna / matikom
* Loads configuration as JSON-String from a remote / AJAX source.
* Adds the Components to the Container body.
* Additionally to its own config options the class accepts all the configuration options
required to configure its internal Ext.Ajax.request().
* The RemoteComponent consists of the lightweight Ext.ux.Plugin.LiteRemoteComponent class and
the more configurable Ext.ux.Plugin.RemoteComponent which extends Ext.util.Observable.
Ext.ux.Plugin.RemoteComponent:
* Several events, which can be used to stop further processing by returning false.
* Processing can also be stopped by config option breakOn at any of the plugins events.
* AJAX requests to the remote source can be defered by config option loadOn to any event of the container. Usefull for lazy loading etc.
* LiteRemoteComponent and RemoteComponent - Plugins can be nested. So a Plugin can load and create Components, which also have (a) RemoteComponent - Plugin(s)
Where to use:
You can use the plugin with any Component with
plugin ability - this is Ext.Container, Ext.Toolbar
and every Component derived from both of them.
For example: TabPanel, Tip, Window, FieldSet, FormPanel,
GridPanel, TreePanel, PagingToolbar, etc.
What to use for?
This is a very small but powerfull plugin. use it for:
- lazy loading of components
- provide different views of components per request
- remote Forms
- cascade component views based on server side authentification
- testing of component configuration. Don´t reload the document,
destroy and reopen a component with a RemoteComponent plugin.
- and many more
评论
popew
2008-07-28
kimmking
2008-07-24
popew 写道
JSVM框架已经解决楼主的需求,按需加载,继承等问题。
JSVM已经对EXT2.1进行重新组织,官方网站http://jsvm.org有实例。
JSVM已经对EXT2.1进行重新组织,官方网站http://jsvm.org有实例。
官方网站和论坛上我ms找不到ext4jsvm的下载链接
popew
2008-07-24
JSVM框架已经解决楼主的需求,按需加载,继承等问题。
JSVM已经对EXT2.1进行重新组织,官方网站http://jsvm.org有实例。
JSVM已经对EXT2.1进行重新组织,官方网站http://jsvm.org有实例。
发表评论
提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则
- 浏览: 2441 次
- 性别:

- 来自: 中华大丈夫学院

- 详细资料
搜索本博客
我的相册
exreport_效果图01
共 2 张
共 2 张
最近加入圈子
最新评论
-
下拉多选的树(Ext.ux.Com ...
我怎么跑起来没有数据啊?好像treeloader没有加载一样,还有数据的回填怎么 ...
-- by mercuryzhang -
JAVA数据结构----1、Hash ...
去看下哈希算法不就得了..
-- by simohayha -
ExReport(v0.1发布)_基于 ...
支持一个 我也在试着写ocx 应该可以学到一些东西
-- by lenky0401 -
下拉多选的树(Ext.ux.Com ...
form表单数据回填如何设置?
-- by kery -
什么样的Element可以mask ...
已经提交了bug到ext-forum
-- by kimmking






评论排行榜