Event handling and 'this' in Sencha Touch
app.controllers.test = new Ext.Controller({
someMethod: function(button, event) {
// prints 'undefined', as this == button, not test
console.log(typeof(this.someMethod));
}
});
someMethod is called when the button is pressed:
handler: app.controllers.test.someMethod
Are there any workarounds? What are the best practices here?
I used to use the bind method of Prototype when developing for webO开发者_C百科S, but don't know how to go about this in Sencha Touch.
Never mind, I found an awesome video that answers my question. Here: http://vimeo.com/17414405
精彩评论