I have a situation where I need to delete items from a store, I am using the remove(record) method and my goal is to only remove the item from the store after the server deletes it and returns a success message. The store uses an ajax proxy to make the DELETE call to the server and is using both autoload and autosync. When remove(record) is called it first removes the record from the store and then proceeds to make the DELETE call to the server.
I find this behavior a bit strange because it seems I have to manually reinsert the model into the store based on the server's response. What makes the situation more complex is that the 'exception' event is being handled by the proxy and not the store. Also the proxy is store agnostic thus catching the exception event generated by the server's response in the proxy, does not allow me to perform operations like rejectChanges on the store.
Obviously there's something wrong with my implementation's logic, so what I need to understand is how to alter the store after the server responds and based on the server's response or if that's not possible how to return the store to its previous state before the operation.