-
24 Dec 2009 1:51 AM #1
Remove a record from a store
Remove a record from a store
Hi,
I have a problem when I remove a record from a store. After a call to save(), the record is still in the store. A second call to save() send a second "remove record" to the server. I would have access to store.removed to remove definitively the record from the store.
Code:var store = new Ext.data.Store( { .... proxy: MyProxy( { api: { ..... destroy: this.remove } }) }); Ext.extend(MyProxy, Ext.data.DataProxy, { // protected doRequest: function(action, rs, params, reader, callback, scope, options) { var onSuccessCallback = function(){ // Here I would remove the record from the store }; switch (action) { case Ext.data.Api.actions.destroy: // Send request to server this.api[action].call(this, rs, onSuccessCallback); break; } } });
-
24 Dec 2009 6:49 AM #2
It seems likely to me that the server's response to the Delete request is not appropriate, such that the client-side Store is not removing the "deleted" record.
If you look at the implementation of Store.save() you will see that it fires all three kinds of requests: "C"reate, "U"pdate and "D"elete. Each of those has a corresponding success-callback. Since you see "D"elete requests going out, you know that the Store understands your request to delete the records. But it's not accepting the host's response. Therefore it is not removing the records from itself ... quite rightly, I might add.
The first thing to check, of course, is that the host's response is "successful." Then follow the request through "Store.execute" and the callback-functions that are established in your case.
It's not a pleasant experience, this kind of troubleshooting, but you'll do it soon enough anyway.
Fortunately, you only have to do it once.


Reply With Quote