rijkvanwel
12 Oct 2012, 1:31 AM
Hi all,
In my Ext 3 application, I have built a grid that does a periodic reload (a news feed), but only refreshes when there is new data on the back end. To accomplish this, I made use of the store's 'loadexception' event, that's triggered in the case of an empty response.
It works as following: on the initial request, a timestamp is added to the response and stored on the front end. This timestamp is then sent along with any subsequent requests to the backend, where it is used to determine if the client is still up to date. If so, the backend returns an empty repsonse, which triggers the loadexception event, and nothing happens (like I want).
In Ext 4, the I cannot find a way to replicate this behaviour. The loadexception event has been removed, and the load event is always triggered, and always considered successfull, even in case of an empty response! At that point, I could detect the response is empty by going into store.proxy.reader.jsonData.responseText, but at this point I can't stop the grid from being refreshed and thus becoming empty.
The only way I've found so far to trigger any exception event (or successfull:false), is to return a HTTP 500 code from the server, which is not what I want to do. I've tried using a 304 (not modified), but this also does nothing.
How can I reproduce this behaviour in the design of Ext 4?
In my Ext 3 application, I have built a grid that does a periodic reload (a news feed), but only refreshes when there is new data on the back end. To accomplish this, I made use of the store's 'loadexception' event, that's triggered in the case of an empty response.
It works as following: on the initial request, a timestamp is added to the response and stored on the front end. This timestamp is then sent along with any subsequent requests to the backend, where it is used to determine if the client is still up to date. If so, the backend returns an empty repsonse, which triggers the loadexception event, and nothing happens (like I want).
In Ext 4, the I cannot find a way to replicate this behaviour. The loadexception event has been removed, and the load event is always triggered, and always considered successfull, even in case of an empty response! At that point, I could detect the response is empty by going into store.proxy.reader.jsonData.responseText, but at this point I can't stop the grid from being refreshed and thus becoming empty.
The only way I've found so far to trigger any exception event (or successfull:false), is to return a HTTP 500 code from the server, which is not what I want to do. I've tried using a 304 (not modified), but this also does nothing.
How can I reproduce this behaviour in the design of Ext 4?