EXT JS close pop up window
12,861
Solution 1
The selector is incorrect, it should just be window
, which will find the parent with a matching xtype.
Solution 2
hmmm... still not answered? the solution is simple
var win = Ext.create('Ext.window.Window', {
id: id,
name: id,
title: title,
width: width,
height: height,
closeAction:'destroy',
autoScroll:'true',
closable:true,
bbar:[{
text:'Close',
handler:function(bt){
bt.up('window').close();
}
}]
})
Solution 3
This should work:
var win = Ext.create('Ext.window.Window', {
title: 'test',
width: 400,
height: 200,
bbar:[{
text:'Close',
handler: function(){
win.destroy();
}
}]
})
working example: http://jsfiddle.net/RdVyz/
Author by
Justin Liang
Updated on June 04, 2022Comments
-
Justin Liang almost 2 years
I have a pop up window without close button, so I have to refresh the page in order to close the pop up window. In this case, I wanna to add an button on the pop up window for closing.
Here is the js code:
function oseGetWIn(id, title, width, height) { var win = Ext.create('Ext.window.Window', { id: id, name: id, title: title, width: width, height: height, closeAction:'destroy', autoScroll:'true', }); return win; }
I tried to add the following, but no effect.
bbar: [ { text: 'Close', handler: function () { this.up('.window').close(); } } ],
-
Justin Liang almost 11 yearsHi, seems it does not work when i deleted the dot before window.
-
Jacobian almost 11 yearsWhat does happan when you click on the Close button? Probably, there are some side errors. Try to trace them looking at firebug.
-
Ashutosh Ojha over 5 yearsThanks, the exact thing I want.