Search code examples
extjstriggersuitextfieldextjs5sencha-architect

Enable trigger to the textfield only when the text is entered Extjs


I have a texfield component to which I gave a trigger but I wanted it to be enabled only when the user types some input into the textfield whenever the user dont enter ant thing it should not enable the trigger icon. Could someone please help me out I am using Extjs 5.1. Here is the fiddle link https://fiddle.sencha.com/#view/editor&fiddle/1up3


Solution

  • You can hide the trigger if the field is empty:

    listeners:{
        change:function(cb, nV) {
            cb.getTrigger('mytrigger').setVisible(!!nV);
        }
    },
    triggers: {
        mytrigger: {
            hidden:true,