Posts Tagged "handler"

ExtJS: Passing Parameter in Function Handler

July 31st, 2010 by aditia rahman / No Comments  

     

This is a very short post in my ExtJS posts, when we dealing with handler config in many component sometimes we want to passing the parameter inside the function, so here the simple code on how I do it

Ext.onReady(function() {
    var myHandler = function (name){
       Ext.Msg.alert('Notification', 'Hello ' + name);
    };

    var form = new Ext.FormPanel({
        frame: true, border: false, buttonAlign: 'center',
        url: 'test.php', method: 'POST',
        buttons: [{
            text: 'Submit Test',
            handler: myHandler.createDelegate(this, ['Luffy'])
        }]
    });

    var winLogin = new Ext.Window({
        title: 'Function Handler Parameter',
        layout: 'fit', width: 200,
        height: 80, resizable: false,
        border: false,
        closable: false, items: [form]
    });
    winLogin.show();
});