[英]extjs4 - Adding custom components to container
我正在嘗試將自定義組件添加到ExtJS4容器中。 但是,當嘗試在onRender方法中將項目添加到容器時,我收到錯誤消息:
無法從AbstractContainer中的doLayout讀取“無法讀取未定義的屬性'layoutBusy'”。 未定義componentLayout屬性。
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);
}
});
我嘗試使用容器的item配置屬性添加組件,並且可以正常工作。 但是,我不確定如何將自定義參數傳遞給組件(需要將模型實例傳遞給組件)。
謝謝你的幫助。
看一下這個例子: 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'
});
(如果您擁有一個以上的組件,則適合的布局不是一個好的選擇)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.