简体   繁体   中英

ExtJS handler in button

I have a question about simple button.

Below definition:

var table = null;
var buttonConfig = {
    buttonId: 'mybutton1',
    text: 'Template button',
    icon: 'style/img/fam/button.png',
    tooltip: 'template button',
    handler: function () {
        var someConfig = null;
        fileProcessing(someButton, someConfig);
    }
};
addButtonToGrid(table, buttonConfig);

Function called fileProcessing has 2 args - someButton and someConfig .

I want to pass in someButtton , the button from object buttonConfig . How should I do it ?

Thanks for any advice

You can do it like below:

handler: function () {
    var someConfig = null;
    var someButton = this;
    fileProcessing(someButton, someConfig);
}

Reference

PARAMETERS

button : Ext.button.Button

This button.

e : Ext.event.Event

The click event.

Hope this will help/guide you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM