【发布时间】:2014-07-09 02:01:40
【问题描述】:
在我的controller (ExtJS 4.2.1) 中,我有一个函数可以创建这样的窗口:
refs: [{
ref: 'holidayView',
selector: '[xtype=holiday.view]'
}],
init: function (application) {
this.control({
'[xtype=holiday.view] button#btnPrint': {
click: me.onPrint
}
});
},
onPrint: function () {
var me = this;
var window = Ext.create('Ext.window.Window', {
title: 'My Window',
itemId: 'myWindow',
width: 300,
height: 300,
modal: true,
layout: fit,
items: [{
xtype: 'panel'
}]
});
window.show();
},
otherFunction: function () {
var me = this;
// here I need to close the window
// I tried this:
var window = me.getHolidayView().up('#myWindow'); // but its undefined
// me.getHolidayView() is accesible
// I also have tried this:
var window = me.getHolidayView().down('#myWindow'); // also its undefined
}
关于如何获取窗口组件以便我可以关闭它的任何线索?
谢谢-
更新:
我试过了,效果很好,但现在确定这是否是正确的方法:
var win = Ext.WindowManager.getActive();
if (win) {
win.close();
}
【问题讨论】:
标签: extjs extjs4 extjs4.1 extjs4.2 extjs-mvc