PDA

View Full Version : Delete from Rest Store keep deleting previous deleted records again



kim2015
20 Feb 2015, 9:33 AM
Hi All,
Below is the code of deleting the records but the first time(after the page reload) deleting a record it has no issue. But when I delete the another record, the store tried to delete it and previous deleted record which cause an error message because the previous doesn't exist.
Don't know how to clear the remove cache or what I should do to prevent the second deletion won't delete the previous record.
Thanks in advance,
Kim

text: 'Delete',
itemId: 'sa-delete',
disabled: true,
handler: function(b, e) {
var selected = this.getSelectionModel().selected;
Ext.Msg.confirm(this._t('Delete User'), this._t('Delete this User'), function(button) {
if (button === 'yes') {
this.store.remove(selected.items);
this.store.sync({
success: function() {
this.fireEvent('deleted', selected.items);
},
scope: this
});
}
}, this);

joel.watson
6 Mar 2015, 7:39 AM
Hi All,
Below is the code of deleting the records but the first time(after the page reload) deleting a record it has no issue. But when I delete the another record, the store tried to delete it and previous deleted record which cause an error message because the previous doesn't exist.
Don't know how to clear the remove cache or what I should do to prevent the second deletion won't delete the previous record.
Thanks in advance,
Kim


This typically happens when there is an error in the sync() of the store, e.g., it does not get back the correct response from the server from the first delete, and so it believes that the first record still needs to be deleted. Can you verify that your sync() is successful? If it is, the workflow should work as expected.

Thanks
Joel