开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜