I am using treepanel and custom treeloader and call the ajax request when click the node. It is working fine in both IE and FF.
But today we found out that if node have only one child (return only one record base on parent node id), then IE does not show child node. Same thing happening in Combo store as well if service return only one reocrd.
Very interesting thing is that I try to debug with Fildder. so I have to put "." dot in my url "http://localhost{.}:1234/ then It is working fine for both tree and combo.
Here is the JSON format return from FF and FireBug. Code:
{"result":[{"href":"..\/EMP\/EmployeeSearch.aspx","iconCls":"","id":"8c362443-7bb3-427e-910c-87b391c6abf5","leaf":true,"text":"Employees"}]}
Here is the corrupted JSON string retrun from IE using developer tool. Code:
{"result":[{"href":"..\/EMP\/E"
My Override TreeLoader
Ext.override(Ext.tree.TreeLoader, {
requestData: function (node, callback) {
if (this.fireEvent("beforeload", this, node, callback) !== false) {
this.transId =
Ext.Ajax.request({
method: this.requestMethod,
url: this.dataUrl || this.url,
success: this.handleResponse,
failure: this.handleFailure,
scope: this,
argument: { callback: callback, node: node },
params: Ext.encode(this.getParams(node)),
//jsonData: { node: node },
headers: this.header || { 'Content-Type': 'application/json;charset=utf-8' }
});
} else {
// if the load is cancelled, make sure we notify
// the node that we are done
if (typeof callback == "function") {
callback();
}
}
}
, processResponse: function (response, node, callback) {
var json = response.responseText;
/*added to remove result wrapper from JSON*/
try {
var obj = Ext.decode(json);
var o = obj.result;
node.beginUpdate();
for (var i = 0, 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);
}
}
} );
Have you tried removing the escape characters or replacing them with Unicode instead?
精彩评论