Skip to content

Commit 0d82645

Browse files
committed
refactor(grid): Update crudService begin method
1 parent 039297f commit 0d82645

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
@@ -151,12 +151,12 @@ export class IgxGridCRUDService {
151151
}
152152

153153
begin(cell): void {
154-
this.cell = this.createCell(cell);
155-
this.cell.primaryKey = this.primaryKey;
154+
const newCell = this.createCell(cell);
155+
newCell.primaryKey = this.primaryKey;
156156
const args = {
157-
cellID: this.cell.id,
158-
rowID: this.cell.id.rowID,
159-
oldValue: this.cell.value,
157+
cellID: newCell.id,
158+
rowID: newCell.id.rowID,
159+
oldValue: newCell.value,
160160
cancel: false
161161
};
162162

@@ -167,20 +167,24 @@ export class IgxGridCRUDService {
167167
return;
168168
}
169169

170-
171170
if (this.rowEditing) {
172171
if (!this.row) {
172+
this.cell = this.createCell(cell);
173+
this.cell.primaryKey = this.primaryKey;
173174
this.beginRowEdit();
174175
return;
175176
}
176177

177-
if (this.row && !this.sameRow(this.cell.id.rowID)) {
178+
if (this.row && !this.sameRow(newCell.id.rowID)) {
178179
this.grid.endEdit(true);
179180
this.cell = this.createCell(cell);
181+
this.cell.primaryKey = this.primaryKey;
180182
this.beginRowEdit();
181183
return;
182184
}
183185
} else {
186+
this.cell = this.createCell(cell);
187+
this.cell.primaryKey = this.primaryKey;
184188
this.endRowEdit();
185189
}
186190
}

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)