Hi all,
Today I noticed strange behaviour of the load() method inside Ext.data.MemoryProxy class.
Function body is as follow:
Code:
load : function(params, reader, callback, scope, arg){
params = params || {};
var result;
try {
result = reader.readRecords(this.data);
}catch(e){
this.fireEvent("loadexception", this, arg, null, e);
callback.call(scope, null, arg, false);
return;
}
callback.call(scope, result, arg, true);
}
There is no success checking if there is no exceptions. Why?
In my code I'm using this MemoryProxy to parse responseXML:
1. make custom Ajax request
2. get the response
3. read the data using MemoryProxy
In my case I can got success = true or false.
So in my opinion mentioned method should looks like:
Code:
load : function(params, reader, callback, scope, arg){
params = params || {};
var result;
try {
result = reader.readRecords(this.data);
}catch(e){
this.fireEvent("loadexception", this, arg, null, e);
callback.call(scope, null, arg, false);
return;
}
if (result.success === true) {
callback.call(scope, result, arg, true);
} else {
callback.call(scope, result, arg, false);
}
}