Search code examples
searchfieldlistenersencha-touch

sencha touch :: useClearIcon listener in searchfield


is there a way to listen to the event, when the user clicks/tabs on the clearIcon in a seachfield?

unfort. the keyup and change listeners are ignored then...

thnx!


Solution

  • I have put the following code on the onFirstActivate method of the panel:

    var clearIconEl = this.getEl().down('[class="x-field-clear-container"]');
    clearIconEl.on('click', this.handleClearIconClick, this);
    

    this catches the clear icon click, though it depends on its undocumented css class.

    UPDATE: I see two much more elegant solutions to this same problem at sencha touch textfield clear event I think I will use one of them myself...