PDA

View Full Version : setActiveItem doesn't fire when inside Ext.Ajax.request



profunctional
16 Nov 2010, 1:50 PM
Why deson't setActiveItem fire when inside setActiveItem?



doLogout: function()
{
var mainPnl = this.mainPanel;
mainPnl.setLoading(true, true);
Ext.Ajax.request({
url: logoffAction,
method: 'post',
success: function(response, opts) {
x = Ext.decode(response.responseText);

if (x.errorMessage != null)
alert(x.errorMessage);
else {
localStorage.clear();
mainPnl.setLoading(false);
mainPnl.setActiveItem(this.loginForm, 'fade');
}
}
});

},

evant
16 Nov 2010, 2:18 PM
I dare say it's throwing an error because this.loginForm is not defined. Note that you're not specifying any scope on the callback.

profunctional
16 Nov 2010, 2:20 PM
If I move it outside of the Ajax request block it works fine. the problem is that I only want to change cards if the request is a success.

evant
16 Nov 2010, 2:43 PM
Note that you're not specifying any scope on the callback.


Important bit in bold.