You should make use of the scope config option in components
.
in Ajax calls
var MyPanel = Ext.extend(Ext.Panel, {
doSave: function(){
Ext.Ajax.request({
url: ‘your_url’,
params: ….
success: function(response){
response = Ext.decode(response.responseText);
this.onSuccess(response)
},
scope: this //the scope in which the success callback [...]