Extjs 4.1 How to call controller action method from form

Posted by Omar Faruq on Stack Overflow See other posts from Stack Overflow or by Omar Faruq
Published on 2012-11-28T06:08:49Z Indexed on 2012/11/28 11:03 UTC
Read the original article Hit count: 268

Filed under:

Extjs 4.1 How to call controller action method from form which is already use in a button action but i want this method reuse from a form field but do not how i can do?

// here is my controller code

 init: function() {
    this.control({
        'itemsgrid': {
            removeitem: this.removeUser
        },
        'salewindow button[action=resetAll]': {
            click: this.resertform
        },            
        'salewindow button[action=saveOrder]' : {
            click : this.onsaveOrder
        },
        'salewindow button[action=PDF]' : {
            click : this. pdfreport
        }
    });
},

resertform : function(button){       
    var store = Ext.data.StoreManager.get('Items');
    store.destroy();
    var vatstore = Ext.data.StoreManager.get('Vats');
    vatstore.reload();
    var rebatestore = Ext.data.StoreManager.get('Rebates');
    rebatestore.reload();
    Ext.getCmp('calculation-form').getForm().reset();       
    Ext.getCmp('itemform2').getForm().reset();        
    Ext.getCmp('itemsgrid').subtotalquantity(p=0);
    store.reload(); 
    var co=store.getCount();
    console.log(co);
    Ext.getCmp('customerID').setValue('0');
    var a = Ext.getCmp('customerID').getValue();
    Ext.getCmp('itemform2').customerinfo(a);        
}

//and here is my from field listener

{
            xtype         : 'textfield',
            name          : 'BranchId',
            fieldLabel    : 'Branch Id',
            allowNegative : false,
            id            : 'branchid',
            value         : '1',                
            onBlur: function(){                                        
                restoreItem();// i want call this method from here whis is stay in controller
            } 
        }

© Stack Overflow or respective owner

Related posts about extjs4