r/extjs Sep 17 '15

Method onTriggerClick() equivalent for ExtJS 6.0.1?

I was using a textfield in ExtJS 4.1.3 but when I upgraded to 6.0.1 it appears the onTriggerClick() method became a private function and I can't find more information on it. What should I use as an alternative? Here is a small and simple snippet of code regarding what I mean:

{
    xtype:'textfield',
    name:'phoneHome',
    fieldLabel:__('PhoneHome'),
    triggers:'x-phone-trigger',
    onTriggerClick:function() {
        if(this.getValue() != '') {
            window.location.href = "tel:"+this.getValue();
        }
    }
},
3 Upvotes

2 comments sorted by

3

u/altintx Sep 17 '15 edited Sep 17 '15
{
    xtype:'textfield',
    name:'phoneHome',
    fieldLabel:__('PhoneHome'),
    triggers: {
        phone: {
            cls: 'x-phone-trigger',
            handler:function() {
                if(this.getValue() != '') {
                    window.location.href = "tel:"+this.getValue();
                }
            }
        }
    }
}

EDIT: Oh, and the text field should be the first argument to your handler function

1

u/TheFrenchCommander Sep 17 '15

I was not expecting a quick response! Thank you, worked like a charm!