PDA

View Full Version : JavaScript Error in JsonReader.readRecords



orla
8 Oct 2009, 3:05 AM
Hi,

I am currently using the extJs 3.0 code in an asp.Net MVC application and I have come across a strange problem.

For updates and deletes I am returning the same basic object from the server. This object simply contains a 'Success' property set to true and a 'data' property set to 'test'. When the jsonReader attempts to read this return data the following happens.

The first line of the readResponse function sets var o depending on the response received from the server.

var o = (response.responseText !== undefined) ? Ext.decode(response.responseText) : response;


Now, as can be see from the screenshots, the comparison
(response.responseText !== undefined) evaluates to true, so the expected value of o would be Ext.decode(response.responseText) and yet o has been set to the value of response.

This is causing statement
if (Ext.isEmpty(o[this.meta.successProperty])) to evaluate to true and the function then throws an exception indicating that the operation has failed, despite the fact that the server has returned a success message.

Can anyone explain this issue?


http://www.extjs.com/forum/attachment.php?attachmentid=16654&stc=1&d=1254999311

http://www.extjs.com/forum/attachment.php?attachmentid=16655&stc=1&d=1254999311

carol.ext
8 Oct 2009, 6:47 AM
Is it looking for upper case S in Success for or lower case s in success?

(What is value of this.meta.successProperty?)

Tefen
8 Oct 2009, 9:09 AM
I'm battling the same.

I've got
successProperty: 'success'
and firebug at this point says my response.responseText is
"{success:true,id:40715}\n"

I tried changing the code of readResponse to:


var o = response;
if(response.responseText !== undefined){
o = Ext.decode(response.responseText);
}


No luck.

Commenting out the if clause gets me the expected value for o. I think something in response.responseText !== undefined is failing.



var o = response;
//if(response.responseText !== undefined){
o = Ext.decode(response.responseText);
//}


Firefox 3.0.14 if that helps.

orla
9 Oct 2009, 12:47 AM
I have moved this thread to the bugs forum
http://www.extjs.com/forum/showthread.php?p=395994#post395994