开发者

EXTJS - Listener for Json Store Loaded with No Data

开发者 https://www.devze.com 2023-02-17 13:57 出处:网络
I\'m trying to update the screen whenever a Json store is done loading data from the server. I tried registering \"load\", and \"datachanged\" listeners, and they both work only if data was either ret

I'm trying to update the screen whenever a Json store is done loading data from the server. I tried registering "load", and "datachanged" listeners, and they both work only if data was either returned, or the data was changed from the cache.

However, there are cases where nothing is returned from the server - an empty string and in this case neither listeners are i开发者_JS百科nvoked at all. What can I do in ExtJS for these special cases?


With a JsonStore even if there are no records it still expects a valid response. So if your root was "data" the store still expects something like

{"data": [], "count": 0}

to be returned. If you don't return anything at all it is most likely throwing an exception. Listen for the "exception" event to see if that is happening.


Have you tried attaching registering with the beforeLoad event? The beforeLoad event fires before a request is sent out for new data, so its possible that the event will fire regardless of data being returned or not.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号