Search code examples
javascriptdom-eventssencha-touchsencha-touch-2

"el" listener not working in Sencha Touch 2


I'm using Sencha Touch 2.0-pr3. I'm having trouble getting the element tap event to work (note that BrowsePage extends Ext.Panel). I'm confused cause this works in Sencha Touch 1. What's changed?!

var resultsPage = Ext.create('bla.myapp.BrowsePage', {
  id: 'searchResults',
  html: str,               
  listeners: {
    el: {
      tap: function() {
        console.log('hi!');
      }
    }
  }
})

Solution

  • Someone answered my questions here: http://www.sencha.com/forum/showthread.php?161806-%E2%80%9Cel%E2%80%9D-listener-not-working-in-Sencha-Touch-2&p=691670&viewfull=1#post691670

    It's not in ST2 yet, so for now override initialize() --

    initialize: function() {
        this.callParent();
    
        this.element.on({
        ...
        });
    }