PDA

View Full Version : Get raw server response after store sync()



neilios
6 Sep 2014, 11:49 AM
I'm not using the Direct package in my app and have been Ok up until now with processing side-band info in my server response using the data provided by the Ext.Ajax request callbacks as they provide that info in the event handler arguments.

I can't figure out at the moment is how to see the full server response after a store sync operation.

I'm using this:


myStore.sync({
callback: function(batch, options) {
// How to find the raw server response?
}
);

I couldn't see the response anywhere in the batch object - am I just missing it or can I find it somewhere else?

Perhaps I need to handle this side-band info differently? I looked at the store/reader metaData change event but couldn't figure out how to really set that up to fire - perhaps there is an example that I can't find right now?

Appreciate any help on this.
Thanks,
Neil

slemmon
8 Sep 2014, 9:51 PM
Hi,
The best option is to listen to the 'write' event which will capture all Create, Update, and Delete actions. The 'load' event will capture all Read actions.
From there you'll have access to the store and can get to the raw data via:



store.getProxy().getReader().rawData;

neilios
9 Sep 2014, 7:08 AM
Ah - that looks promising.I did get to try the metadata change event on the reader proxy too and that seems to be working - though I had to replicate the response success/status in the metaData at the server so I will see if this approach can help reduce that.Thanks,Neil