PDA

View Full Version : Store do something after sync with autoSync enabled



Fire-Dragon-DoL
12 Jun 2012, 10:07 AM
I'm trying to detect and remove those fields that after a sync are still on the store but are not added to the database (success: false). Then, return an error message to the user (with some error codes). However I can only see a "beforesync" event in store documentation.

Are there any possibility to do such a thing? I'm trying with "update" events but they are called after syncing only if the sync is successfull (otherwise they are called only before sync).

I can't really find an event that is fired after sync.
Any solution for this?

Notice that I'm using autoSync, that's why I can't hook to the callback, otherwise everything will be easier.

Another important point I can see in the documentation is:



Ext.data.Model.EDIT Ext.data.Model.REJECT Ext.data.Model.COMMIT

Why REJECT event is never fired? I thought that if success = false REJECT would be called, do I require something like a 404 to obtain that result?

EDIT: No, I can't find a way to fire REJECT version of the update event. Any suggestion?

scottmartin
8 Jul 2012, 7:00 PM
For anyone following, there was an answer provided on SO:
http://stackoverflow.com/questions/11022616/store-do-something-after-sync-with-autosync-enabled

Scott.

Fire-Dragon-DoL
8 Jul 2012, 7:24 PM
Good idea, thanks a lot. The answer was good!