Skip to content

Commit

Permalink
Re-insert events into event store if delete operation fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
gsidler committed Mar 10, 2015
1 parent 620045e commit 6c35ea4
Showing 1 changed file with 17 additions and 2 deletions.
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

0 comments on commit 6c35ea4

Please sign in to comment.