Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-insert events into event store if delete operation fails. #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/calendar/view/AbstractCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
Ext.define('Extensible.calendar.view.AbstractCalendar', {
extend: 'Ext.Component',

requires: [
'Ext.CompositeElement',
'Extensible.calendar.form.EventDetails',
Expand Down Expand Up @@ -1565,7 +1565,22 @@ Ext.define('Extensible.calendar.view.AbstractCalendar', {
}
}
}, this);


// Restore deleted records back to their original positions.
// This code was copied from ExtJS V4.2.2 Ext.data.Store, function rejectChanges(). In order to maintain
// backwards compatibility with version 4.0.7, this function cannot be called directly.
var recs = this.store.removed,
len = recs.length,
i = 0, rec;

for (i = len-1; i >= 0; i--) {
rec = recs[i];
this.store.insert(rec.removedFrom || 0, rec);
rec.reject();
}
// Since removals are cached in a simple array we can simply reset it here.
this.store.removed.length = 0;

if (this.fireEvent('eventexception', this, response, operation) !== false) {
this.notifyOnException(response, operation);
}
Expand Down