ExtJS 3.动态附加配置
有没有什么方法可以将一些配置(对象属性)附加到创建的 extobject。
var thePanel = new Ext.Panel({
border: false
});
thePanel.addpendConfigs({ //How to?
height: 40,
region: "north"
});
Is there any way to apend some configs (object properties) to created extobject.
var thePanel = new Ext.Panel({
border: false
});
thePanel.addpendConfigs({ //How to?
height: 40,
region: "north"
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我从设置北部区域猜测您不想将面板添加到具有边框布局的容器中...我相信您可以执行类似
dolayout 方法的操作,应该强制重新计算所有组件上的布局...
编辑:
对于通用解决方案,请检查 Ext.apply
但我认为您仍然需要像上面那样强制重新计算布局
i'm guessing from setting the region north that you wan't to add the panel to a container with border layout ... I believe you can do something like
dolayout method should force the recalculation of the layout on all the components ...
Edit:
For the universal solution check Ext.apply
But i think you still need to force the layout recalculation like above
使用
Ext.applyIf
。来自 文档
定义如下:
否则使用 Ext.apply
定义:
Use the
Ext.applyIf
.From the docs
Here's the definition:
Otherwise use the Ext.apply
Definition:
据我所知,一旦对象被实例化,您就不能简单地向其中添加新的配置选项。它冒泡太多(例如,假设您想覆盖“items”数组,这会影响您的实际对象)。
一般来说,ExtJs 有一种方法可以做你想做的事情。
As far as I know, once the object has been instantiated, you cannot simply whack new config options into it. It bubbles too much ( eg, say for example you want to overwrite the "items" array, this affects quite a bit of your actual object ).
Generally ExtJs has a method to do what you want to do however.