Skip to content

Commit cabb1a5

Browse files
committed
refactor(grid): Update crudService begin method
1 parent b087ddb commit cabb1a5

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

projects/igniteui-angular/src/lib/core/grid-selection.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ export class IgxGridCRUDService {
152152
}
153153

154154
begin(cell): void {
155-
this.cell = this.createCell(cell);
156-
this.cell.primaryKey = this.primaryKey;
155+
const newCell = this.createCell(cell);
156+
newCell.primaryKey = this.primaryKey;
157157
const args = {
158-
cellID: this.cell.id,
159-
rowID: this.cell.id.rowID,
160-
oldValue: this.cell.value,
158+
cellID: newCell.id,
159+
rowID: newCell.id.rowID,
160+
oldValue: newCell.value,
161161
cancel: false
162162
};
163163

@@ -168,20 +168,24 @@ export class IgxGridCRUDService {
168168
return;
169169
}
170170

171-
172171
if (this.rowEditing) {
173172
if (!this.row) {
173+
this.cell = this.createCell(cell);
174+
this.cell.primaryKey = this.primaryKey;
174175
this.beginRowEdit();
175176
return;
176177
}
177178

178-
if (this.row && !this.sameRow(this.cell.id.rowID)) {
179+
if (this.row && !this.sameRow(newCell.id.rowID)) {
179180
this.grid.endEdit(true);
180181
this.cell = this.createCell(cell);
182+
this.cell.primaryKey = this.primaryKey;
181183
this.beginRowEdit();
182184
return;
183185
}
184186
} else {
187+
this.cell = this.createCell(cell);
188+
this.cell.primaryKey = this.primaryKey;
185189
this.endRowEdit();
186190
}
187191
}

projects/igniteui-angular/src/lib/grids/api.service.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,9 @@ export class GridBaseAPIService <T extends IgxGridBaseComponent & IGridDataBinda
118118
public submit_value() {
119119
const cell = this.grid.crudService.cell;
120120
if (cell) {
121-
if (!(isEqual(cell.value, cell.editValue))) {
122-
const args = this.update_cell(cell, cell.editValue);
123-
if (args.cancel) {
124-
return;
125-
}
121+
const args = this.update_cell(cell, cell.editValue);
122+
if (args.cancel) {
123+
return;
126124
}
127125
this.escape_editMode();
128126
}

0 commit comments

Comments
 (0)