PDA

View Full Version : [CLOSED]Ajax argument



James Goddard
22 Feb 2011, 7:12 AM
Again this is not necessarily a bug since it was undocumented before but the Ajax singleton used to allow you to pass an "argument" property. This property was then copied to the response object to be used in the callback function.

This functionality has been removed in 4. Is it possible to get it back?

James Goddard
22 Feb 2011, 7:18 AM
Oops,

Turns out the functionality is still there (sort of). I can get the data from the callback through response.request.options.argument instead of response.argument.

evant
22 Feb 2011, 7:47 PM
It's still available:



Ext.require('*');
Ext.onReady(function(){
Ext.Ajax.request({
url: 'data.json',
foo: 'foo',
success: function(response, options){
console.log(options.foo);
}
});
});

James Goddard
23 Feb 2011, 5:28 AM
Strictly speaking it was taken out. The old code had:


handleResponse : function(response){
this.transId = false;
var options = response.argument.options;
response.argument = options ? options.argument : null;
this.fireEvent(REQUESTCOMPLETE, this, response, options);
if(options.success){
options.success.call(options.scope, response, options);
}
if(options.callback){
options.callback.call(options.scope, options, true, response);
}
},

But as long as there are workarounds I'm good.