View Full Version : How to handle empty data in Ext.data.proxy.Ajax?

10 Dec 2012, 1:03 AM

I have a lot of stores in my ExtJS app. I want to make these kinda failproof and I'm trying to catch that case when there is empty response returned from the server. It should catch only empty responses with no text and no HTTP errors.
First I tried looking for 'loadexception' listener for the Ext.data.Store, but it appear there is no such event.
Then I tried looking for something similar in the Ajax Proxy and there it was - 'exception' event. I was like 'hoooraaay', but after testing it appears it responds only to HTTP errors (like if I send error 500 from my PHP app), but not to empty responses.

What event should I use?
It appears all Store-related events are about fetched records (seems logical). I'm working on a state where there cannot be any records, so I think it should be something out of the Store classes.
Next logical stop was the proxy, but no related events found there.

I digged into the source and it seems something can be done in the Ext.data.proxy.Server processResponse() method. It doesn't seem very right, though.

What do you think?

11 Dec 2012, 1:05 PM
I would probably do it in the readRecords method of a reader.