1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    219
    Vote Rating
    5
    Answers
    10
    webfriend13 is on a distinguished road

      0  

    Default Answered: Closing pop up window on click of button

    Answered: Closing pop up window on click of button


    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.

  2. Quote Originally Posted by webfriend13 View Post

    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();
    }
    }

  3. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    219
    Vote Rating
    5
    Answers
    10
    webfriend13 is on a distinguished road

      0  

    Default


    Quote Originally Posted by webfriend13 View Post

    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();
    }
    }