Manoj Pandey
Manoj Pandey

Reputation: 87

Perform action after close a child window in extjs

Hello i am creating a panel window and i want to save data after fill valid id. if id does not exits then i show a panel window and here will be create a valid id. After create valid id user will close window. After close window i have need to form on server. I am also attaching code and screenshot

// check id exist on database or not
   var myId= me.lookupReference('myId').getValue();    
        Ext.Ajax.request({
            url: './MyController/CheckExistId',
            method: 'POSt',
            params: {
                myId: myId
            },
            success: function (response) {
                var result = Ext.JSON.decode(response.responseText);
                if (result.success === true && result.data !== null) {
                    if (result.data === 0) {
                    Ext.create('MySample.view.register', { id: myId }).show();
                    }
                    else {
                        me.submitData();
                    }
                }

            } 

Window screenshot for create new id

Window screenshot

after close window i want to submit form automatically by using me.submitData() function

Upvotes: 1

Views: 1182

Answers (1)

oberbics
oberbics

Reputation: 408

Add a listener to MySample.view.register like:

Ext.create('MySample.view.register', { 
   id: myId,
   closeAction : 'destroy',
   listeners: {
      // catch the close action
      'destroy' : function() {
           me.submitData();
       }
   }).show();

The event to catch is based on which kind of component MySample.view.register is extending of.

Upvotes: 2

Related Questions