PDA

View Full Version : handleResponse does not make the correct callback method



skotamreddy
22 Jul 2011, 9:41 AM
Hi,

We are in the process of moving from Ext JS ver 2 to ver 4. As a first step, I installed ver 3 and made the appropriate changes to get the site up and running to a certain extent. I am running into the following issue.

We have a ResultsPanel object that extends Ext.Panel. This object populates the data that we get as part of the response. The execute function of ResultsPanel is as follows,


execute: function(el, params, ajax){
if (ajax)
{
if (this.ajaxSuccessHandler == undefined){
this.ajaxSuccessHandler = this.handleAjaxSuccess.createDelegate(this);
this.htmlSuccessHandler = um.processSuccess;
}
um.processSuccess = this.ajaxSuccessHandler;
}
else {
if (this.htmlSuccessHandler != undefined){
if (um.processSuccess != this.htmlSuccessHandler){
um.processSuccess = this.htmlSuccessHandler;
}
}
}
...
}
When the code executes, it has the ajax variable set to be true and um.processSuccess is assigned the AjaxSuccessHandler. So far so good.

When the call comes to handleResponse function in ext-all-debug.js, I was expecting the callback method for options.success to point to handleAjaxSuccess instead it points to htmlSuccessHandler which calls the default renderer that does not know how to handle ajax response. The scope is still the resultsPanel. This works in ver 2. Any ideas?

Thanks,
Srinivas

skotamreddy
26 Jul 2011, 11:02 AM
Hi,

Is there any more information needed to resolve this? This is a show stopper for us from going forward. I would appreciate a response.

Thanks,
Srinivas

skotamreddy
27 Jul 2011, 9:46 AM
Here is some more info. When debugging both Ext JS2 and Ext JS3 and capturing the information of response in handleResponse function, I see the following difference in response.argument.options.success and response.argument.options.scope members.



Ext JS2
scope: Ext.Updater.Ext.extend.constructor

success: function (){var F=B||arguments;if(A===true){F=Array.prototype.slice.call(arguments,0);F=F.concat(B)}else{if(typeof A=="number"){F=Array.prototype.slice.call(arguments,0);var E=[A,0].concat(B);Array.prototype.splice.apply(F,E)}}return D.apply(C||window,F)}

(This is nothing but the createdelegate function)

Ext JS3
scope:constructor

success:function processSuccess(response){ var me = this; me.transaction = null; if (response.argument.form && response.argument.reset) { try { response.argument.form.reset(); } catch(e){} } if (me.loadScripts) { me.renderer.render(me.el, response, me, updateComplete.createDelegate(me, [response])); } else { me.renderer.render(me.el, response, me); updateComplete.call(me, response); } }
Am I missing any explicit call during the migration from 2.0 to 3.0?