extjs4 - 将自定义组件添加到容器
extjs4 - Adding custom components to container
我正在尝试将自定义组件添加到 ExtJS4 容器中。但是,当尝试在 onRender 方法中将项添加到容器时,我收到错误:
"无法从 AbstractContainer 中的 doLayout 中读取属性 'layoutBusy' of undefined"。未定义组件布局属性。
Ext.define('App.view.dashboard.RightContainer', {
extend: 'Ext.container.Container',
uses: [
'App.view.Component1',
'App.view.Component2'
],
alias: 'widget.dashboardright',
layout: 'fit',
border: 0,
onRender: function() {
var self = this;
self.callParent(arguments);
var component1 = Ext.create('App.view.Component1', {
height: '300px',
flex: 1,
incidents: self.dashboard.get('incidents')
});
var component2 = Ext.create('App.view.Component2', {
flex: 1,
contact: self.dashboard.get('contacts')
});
self.add(component1);
self.add(component2);
}
});
我尝试使用容器的项目配置属性添加组件,它可以工作。但是,我不确定如何将自定义参数传递给组件(需要将模型实例传递给组件)。
感谢您的任何帮助。
看看这个例子: http://jsfiddle.net/ChE59/
我正在向容器添加 3 个面板并传入一些自定义属性。
Ext.define('App.view.dashboard.RightContainer', {
extend: 'Ext.container.Container',
alias: 'widget.dashboardright',
border: 0,
constructor: function(config){
Ext.apply(this, {
items: [
{
title: 'panel 1'
},
{
title: 'panel 2'
},
{
title: config.customParameter
}
]
});
this.callParent(arguments);
}
});
Ext.widget('dashboardright', {
renderTo: Ext.getBody(),
customParameter: 'custom parameter'
});
(如果您有更多的一个组件,适合布局不是一个好的选择)
相关文章:
- 如何定义组件添加到DataItem的顺序
- 通过格式化将jquery移动组件动态添加到列表视图中
- React-router 在添加历史记录后不会渲染组件
- 将自定义属性添加到 vuejs 组件
- React:向现有组件添加道具
- react-将图标添加到组件内部的标题中
- 在React中动态添加子组件
- 向React中的高阶组件添加方法
- 动态添加子组件值时,如何从父组件访问这些值
- Tabtastic,javascript组件..如何添加eventlistener来捕获选项卡单击
- 如何在 ExtJS5 中从控制器向视图添加组件
- 添加组件时,反应最大调用栈
- 如何在ember js中以编程方式在其他组件/视图中添加组件或视图
- 无法在Enyo中动态添加组件(按钮)
- 如何添加组件“隐藏”然后把它滑进去
- 为每个reactJS组件添加组件
- 向容器中添加组件不起作用
- 如何在另一个组件中有条件地添加组件
- 在vue.js中动态添加组件不工作
- 在ExtJS中向选项卡窗格添加组件