【发布时间】:2012-09-09 17:22:26
【问题描述】:
如何在调用回调函数时保留this?
init: function() {
console.log( this ); // constructor, YES!
this.readConfig();
},
readConfig: function() {
console.log( this ); // constructor, YES!
this.httpApi.request({
module : 'monitor',
func : 'getConfig',
success : this.readConfigCallback,
scope : this
});
},
readConfigCallback: function(oResponse) {
console.log( this ); // Window, NO!
var oView = this.getView(); // error...
}
【问题讨论】:
标签: extjs callback scope extjs4.1