Skip to content

Commit 6185482

Browse files
committed
Do not clear neither transactions nor newData when canceling rowEdit event. Update correctly cell form control values when canceling cell editing with escape.
1 parent 15c9ef5 commit 6185482

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

projects/igniteui-angular/src/lib/grids/common/crud.service.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,6 @@ export class IgxRowCrudState extends IgxCellCrudState {
368368
this.updateRowEditData(this.row, this.row.newData);
369369
args = this.rowEdit(event);
370370
if (args.cancel) {
371-
delete this.row.newData;
372-
this.grid.transactions.clear(this.row.id);
373371
return args;
374372
}
375373
}
@@ -576,7 +574,7 @@ export class IgxGridCRUDService extends IgxRowAddCrudState {
576574
return;
577575
}
578576

579-
if (this.nonEditable){
577+
if (this.nonEditable) {
580578
console.warn('The grid must have a `primaryKey` specified when using `rowEditable`!');
581579
return;
582580
}
@@ -688,10 +686,13 @@ export class IgxGridCRUDService extends IgxRowAddCrudState {
688686
return args.cancel;
689687
}
690688
} else {
689+
// needede because this.cell is null after exitCellEdit
690+
// thus the next if is always false
691+
const cell = this.cell;
691692
this.exitCellEdit(event);
692-
if (!this.grid.rowEditable && this.cell) {
693-
const value = this.grid.transactions.getAggregatedValue(this.cell.id.rowID, true) || this.cell.rowData;
694-
this.grid.validation.update(this.cell.id.rowID, value);
693+
if (!this.grid.rowEditable && cell) {
694+
const value = this.grid.transactions.getAggregatedValue(cell.id.rowID, true) || cell.rowData;
695+
this.grid.validation.update(cell.id.rowID, value);
695696
}
696697
}
697698

0 commit comments

Comments
 (0)