Window 点击“X”关闭之后无法show

时间:2024-12-30 16:06:32

将Window的属性closeAction设置为hide就可以了。

var panel1 = Ext.create('Ext.panel.Panel', {
title: 'this is panel 1',
width: 100,
height: 60
}); var panel2 = Ext.create('Ext.panel.Panel', {
title: 'this is panel 2',
width: 200,
height: 60
}); var win = Ext.create('Ext.window.Window', {
title: 'Window',
width: 300,
height: 200,
layout: 'auto',
closeAction : 'hide',
items: [panel1,panel2]
}); Ext.onReady(function(){ Ext.create('Ext.panel.Panel', {
title: 'This is a panel',
width: '100%',
height: '100',
renderTo: Ext.getBody(),
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items:[
{
text: 'show me',
handler: function(){
win.show();
}
},
{
text: 'close me',
handler: function(){
win.hide();
}
}
]
}
]
});
});