PDA

View Full Version : Ajaxproxy: can't handle success false



katamshut
14 Sep 2011, 5:55 PM
Hi everybody

I have a problem with my ajaxproxy. It's defined within my store:


proxy: {
type: 'ajax',
url : 'calendarData.php',
reader: {
type: 'json',
root: 'calendarList'
},
extraParams: {
action: 'load'
}
}

here I fire a request:



this.store.load({
scope : this,
callback: function(records, operation, success) {
alert(success);
}
});


which returns the following JSON:



{"success":false, "calendarList": [{"id":"20110...xed","prio_cd":"0"}]}


The Proxy just reads the calendar list and ignores simply the "success: false". Why?

I read for hours the api to find a place which describes how to catch an success: false.. but I wasn't able to I-|

thx for any hints on this.

katamshut
15 Sep 2011, 6:11 AM
ok I debuged the code and found the readers class JsonReader which just adds success = false and returns the data...



if (this.successProperty) {
value = this.getSuccess(data);
if (value === false || value === 'false') {
success = false;
}
}


records = this.extractData(root, true);
recordCount = records.length;


return new Ext.data.ResultSet({
total : total || recordCount,
count : recordCount,
records: records,
success: success
});




at this position I would like to add a listener to stop the process when success = false. But this seams to be not possible..

See I wanted to take it as simple as possible. Maybe I understand something badly or this feature will implemented in a next release. Meanwhile I use


App.views.calendarForm.submit(....)

instead.

katamshut
15 Sep 2011, 9:06 AM
I solved the problem for me:

http://www.sencha.com/forum/showthread.php?126656-Where-to-trap-Store-Proxy-exception/page2&highlight=call+method+%27add%27+undefined