当前位置: 代码迷 >> JavaScript >> ExtJS 升级到4.0.7的有关问题
  详细解决方案

ExtJS 升级到4.0.7的有关问题

热度:86   发布时间:2012-06-30 17:20:12.0
ExtJS 升级到4.0.7的问题

升级 ExtJS 至 4.0.7 时遇到的几个小问题

1、 新的类库体系

旧的类定义方式为:
?
1
2
3
4
5
6
App.view.Viewport = Ext.extend(Ext.panel.Panel, {
???initComponent: function() {
??????// call parent initComponent method
??????App.view.Viewport.superclass.initComponent.apply(this, arguments);
???}
});
新的类定义方式为:
?
1
2
3
4
5
6
Ext.define('App.view.Viewport', {
???initComponent: function() {
??????// call parent?
??????this.callParent(arguments);
???}
});

2、 Ext.Loader 动态加载 js 文件

4.0.7 版本的 Ext.Loader 默认是未启用动态加载的, 导致运行时会报错, 要手工设置启用动态加载, 启用动态加载的代码为:
?
1
Ext.Loader.setConfig({? enabled: true });
Ext.Loader 还有几个有用的参数(paths、 disableCaching)等, 可以查看相关 Ext.Loader API。

3、 Ext.panel.Panel 的 onResize 方法已经删除

没错, Ext.panel.Panel 的 onResize 方法已经删除, 重写 onResize 方法的类需要稍微修改一下, 推荐使用 componentLayout 事件或者 afterComponentLayout 方法。

4、 Ext.panel.Panel 的 collapsible 设置为 true 时,必须设置 panel 宽度

如果没有设置 panel 的宽度, 点击 panel 的 collapse 工具按钮时, 会导致整个 panel 不可见。

5、 不能手工刷新 Ext.form.ComboBox 的 store 的数据

如果用代码刷新了 ComboBox 的 store 的数据, 会导致其弹出的选择列表一直显示“正在加载”, 无法进行选择, 如果必须要刷新 store 数据, 只能改用其它的控件代替 ComboBox。
  相关解决方案