When deleting from a grid using pcrud.autoApply, the grid
should be refreshed only at the very end. Otherwise, even if you're
deleting only one row, the grid reload could occur before the
deletion is committed, yielding a grid fetch error when
pcrud complains about verifying access to a row that is
no longer in the database.
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Jane Sandberg <sandbergja@gmail.com>
currentGrid = this.paramGrid;
}
idlThings.forEach(idlThing => idlThing.isdeleted(true));
+ let _deleted = 0;
this.pcrud.autoApply(idlThings).subscribe(
val => {
console.debug('deleted: ' + val);
this.deleteSuccessString.current()
.then(str => this.toast.success(str));
- currentGrid.reload();
+ _deleted++;
},
err => {
this.deleteFailedString.current()
.then(str => this.toast.danger(str));
+ },
+ () => {
+ if (_deleted > 0) {
+ currentGrid.reload();
+ }
}
);
}