PDA

View Full Version : If ajax request that returns json array with ONLY ONE RECORD, not working in IE



alexaung
26 Aug 2010, 10:55 PM
Hi All,
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.


{"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.


{"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);
}
}
}
);

alexaung
30 Aug 2010, 12:48 AM
I still facing hard time with this issue. Any pointer are very welcome.

Regards,
Alex

alexaung
30 Aug 2010, 8:15 PM
Hi All,

I solved this issue. I think that I should share my experience in here and so that other people will not waste the time like me. :)

Symptom:


IE 8 partially cut of my JSON data return from WCF service when build and test ASP.NET sites and applications using The ASP.NET Development Server that comes built-into Visual Studio

Resolution:


Enabling IIS Express - that combines the best characteristics of both, and which will make it easier to build and run ASP.NET sites and applications.IIS Express will work with VS 2010 and Visual Web Developer 2010 Express, will run on Windows XP and higher systems, does not require an administrator account, and does not require any code changes to use. You will be able to take advantage of it with all types of ASP.NET applications, and it enables you to develop using a full IIS 7.x feature-set.


http://weblogs.asp.net/scottgu/archive/2010/06/28/introducing-iis-express.aspx