PDA

View Full Version : Closing pop up window on click of button



webfriend13
12 Mar 2012, 1:23 AM
6 - 10 Tampines

Hi All,

I have a page, which is having a toolbar. Toolbar has a button on click of which I open a pop up window. Following is the code

Parent window:

dockedItems: [{
xtype: 'toolbar',
items: [{
text: 'Add Customer',
iconCls: 'icon-add',
handler: function () {
var addCust = Ext.widget('addCustomerView');
addCust.show();
}
}]
}],
style: {
margin: '10px'
},
viewConfig: {
emptyText: '<div style="padding:10px;">No customer added...</div>',
deferEmptyText: false
}

addCustomerView :

{
xtype: 'panel',
height: 50,
region: 'south',
items: [{
xtype: "button",
id: "button-close",
text: "Close",
cls: 'x-btn-right'
}]
}]

The pop up window have a close button. I want to close the pop up window using ExtJS controller. I am not sure how to get handle for the window on the click of button in the controller. Kindly suggest how to close the pop up using Extjs MVC.

webfriend13
12 Mar 2012, 2:21 AM
Hi All,

I have a page, which is having a toolbar. Toolbar has a button on click of which I open a pop up window. Following is the code

Parent window:

dockedItems: [{
xtype: 'toolbar',
items: [{
text: 'Add Customer',
iconCls: 'icon-add',
handler: function () {
var addCust = Ext.widget('addCustomerView');
addCust.show();
}
}]
}],
style: {
margin: '10px'
},
viewConfig: {
emptyText: '<div style="padding:10px;">No customer added...</div>',
deferEmptyText: false
}

addCustomerView :

{
xtype: 'panel',
height: 50,
region: 'south',
items: [{
xtype: "button",
id: "button-close",
text: "Close",
cls: 'x-btn-right'
}]
}]

The pop up window have a close button. I want to close the pop up window using ExtJS controller. I am not sure how to get handle for the window on the click of button in the controller. Kindly suggest how to close the pop up using Extjs MVC.


=============

Hi All,

I have got a solution. not sure this is the best one though.

In the controller, I am catching the click event of the button. & closing the window using WindowManager

onCloseButtonClick: function (btn, eOpts) {
//Get the active window
var win = Ext.WindowManager.getActive();
if (win) {
win.close();
}
}