user3546785
user3546785

Reputation: 177

ExtJs - How to clear the existing value in editable combobox when user starts typing a new value

I have an editable combobox. There will be an existing value in this combobox which comes by default or the user selects it from the dropdown. Now if the user wants to enter a new value in this combobox, I want the existing value to be cleared on the users first keypress. Now I have to select the existing value manually and delete it and then start typing a new value. Is there a way to handle this so that as soon as a user starts typing a value in the combobox, the old value should be cleared out.

Thanks,

Upvotes: 1

Views: 5357

Answers (1)

Dev
Dev

Reputation: 3932

 1. You can do it by using **focus** event listener for combo
 listeners:{
    focus:function( combo, The, eOpts ){
             combo.clearValue();
           }

  }
 2. You can use **keypress/keyup** event listeners also depending

on your requirements by enabling key events using enableKeyEvents :true for combo.

 listeners:{
    keypress:function( combo, e, eOpts ){
             combo.clearValue();
           }

  }

Upvotes: 3

Related Questions