Apr 27, 2012, 12:22 AM
[CLOSED] Ext.NetServiceTreeLoader processResponse override does not implement loader.load() signature with scope parameter?
I noticed that when was adding a callback to the load() call off the web services tree loader object that the scope param I supplied was not being applied.
// @source core/tree/WebServiceTreeLoader.js
Ext.NetServiceTreeLoader = Ext.extend(Ext.tree.TreeLoader, {
// private override
processResponse : function (response, node, callback) {
var json,
root;
if (this.json) {
root = Ext.decode(response.responseText);
json = root.d || root;
} else {
var xmlData = response.responseXML;
root = xmlData.documentElement || xmlData;
json = Ext.DomQuery.selectValue("json", root, "");
}
try {
var o = Ext.isString(json) ? eval("(" + json + ")") : json,
i = 0,
len;
node.beginUpdate();
for (i, len = o.length; i < len; i++) {
var n = this.createNode(o[i]);
if (n) {
node.appendChild(n);
}
}
node.endUpdate();
if (typeof callback === "function") {
callback(this, node);
}
} catch (e) {
this.handleFailure(response);
}
}
});
I updated the source to this .. I hope I got it right. If not, can the scope param be added and SVN updated?
// @source core/tree/WebServiceTreeLoader.js
Ext.NetServiceTreeLoader = Ext.extend(Ext.tree.TreeLoader, {
// private override
processResponse : function (response, node, callback, scope) {
var json,
root;
if (this.json) {
root = Ext.decode(response.responseText);
json = root.d || root;
} else {
var xmlData = response.responseXML;
root = xmlData.documentElement || xmlData;
json = Ext.DomQuery.selectValue("json", root, "");
}
try {
var o = Ext.isString(json) ? eval("(" + json + ")") : json,
i = 0,
len;
node.beginUpdate();
for (i, len = o.length; i < len; i++) {
var n = this.createNode(o[i]);
if (n) {
node.appendChild(n);
}
}
node.endUpdate();
this.runCallback(callback, scope || node, []);
} catch (e) {
this.handleFailure(response);
}
}
});
runCallback() seemed to do a type check on the object to see if the callback was a function, so I removed the type check in lieu of runCallback().
Last edited by Daniil; Apr 27, 2012 at 11:40 AM.
Reason: [CLOSED]