我试图通过扩展Ext.Window类来创建一个弹出窗口:
Ext.define('mine.nameCreationPopup',{
extend: 'Ext.Window',
alias: 'nameCreationPopup',
config:{
title: 'aTitle', //default value
width: 700 //default value
},
constructor: function(config){
this.initConfig(config);
this.superclass.constructor.call
(this, {
title: config.title,
width: config.width,
height: 300, //ignored from now on
layout: 'fit',
bodyStyle: 'padding:5px;',
modal: true,
resizable: false
});
}
现在,创作:
var pops = Ext.create('nameCreationPopup',{title:'Dunno'});
pops.show();
pops.center();
当前设置宽度和标题(标题为Dunno,宽度为700作为默认值)无论如何高度和其余窗口属性都被忽略。 怎么样?
答案 0 :(得分:0)
这不是Ext.define的样子。直接配置窗口(内联)或使用initComponent
。内联配置:
Ext.define('mine.nameCreationPopup',{
extend: 'Ext.Window',
alias: 'widget.nameCreationPopup',
title: 'aTitle',
width: 700,
height: 300, //ignored from now on
layout: 'fit',
bodyStyle: 'padding:5px;',
modal: true,
resizable: false
});
initComponent:
Ext.define('mine.nameCreationPopup',{
extend: 'Ext.Window',
alias: 'widget.nameCreationPopup',
initComponent:function() {
Ext.applyIf(this, {
title: 'aTitle',
width: 700,
height: 300, //ignored from now on
layout: 'fit',
bodyStyle: 'padding:5px;',
modal: true,
resizable: false
});
this.callParent(arguments);
}
});