PDA

View Full Version : Weird exception when doing a "CREATE" action through JsonStore



JKeane
10 Dec 2009, 11:35 AM
I'm running into a problem with my JsonStore. I've gotten it to pass the Record to the proper handler, and while the record is successfully inserted (when I reload the page, it's there) and I get a 200 response from the server, the event that's triggered is "exception", not "write". The weird thing is this doesn't happen for my update and destroy actions.

Response from the server:

{success: true}

Listeners:

listeners: {
write: function (dp, action, data, response, record) {
haveRecordsBeenTouched = true;
record.commit();
},
exception: function (proxy, type, action) {
switch (action) {
case 'read':
errMsg = "There was a problem retrieving the data.";
break;
default:
errMsg = "There was a problem saving your updates.";
}
Ext.Msg.show({
buttons: Ext.Msg.OK,
icon: Ext.Msg.WARNING,
title: "Error",
msg: errMsg
})
}
}

JKeane
11 Dec 2009, 7:54 AM
I've made a little more progress wrapping my brain around this problem. I logged some of the arguments passed to the exception event.


Type: response
Action: create


Which means that the exception is caused by a malformed packet. Since the packet is


{success: true}

I wonder: is it because the request needs additional data (will I need to return the inserted record as well?) and adhere to the root/totalProperty config params?