Skip to content

Commit bd3bf13

Browse files
MKirovaMKirova
authored andcommitted
fix(igxGrid): Update editValue if grid data is changed externally.
1 parent bb28024 commit bd3bf13

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,9 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
926926
this.highlight.lastSearchInfo.caseSensitive = this.grid.lastSearchInfo.caseSensitive;
927927
this.highlight.lastSearchInfo.exactMatch = this.grid.lastSearchInfo.exactMatch;
928928
}
929+
if (this.formControl && this.formControl.value !== changes.value.currentValue) {
930+
this.formControl.setValue(changes.value.currentValue);
931+
}
929932
}
930933
}
931934

projects/igniteui-angular/src/lib/grids/grid/grid-cell-editing.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,27 @@ describe('IgxGrid - Cell Editing #grid', () => {
11651165
expect(cell.value).not.toEqual(cellValue);
11661166
expect(cell.value).toEqual(newValue);
11671167
});
1168+
1169+
it('should update editValue when externally changing grid data.', () => {
1170+
const cell = grid.getCellByColumn(0, 'fullName');
1171+
cell.editMode = true;
1172+
fixture.detectChanges();
1173+
1174+
expect(cell.editMode).toBeTruthy();
1175+
expect(cell.editValue).toBe('John Brown');
1176+
1177+
fixture.detectChanges();
1178+
cell.editMode = false;
1179+
fixture.detectChanges();
1180+
1181+
grid.data[0].fullName = "Test";
1182+
fixture.detectChanges();
1183+
1184+
cell.editMode = true;
1185+
fixture.detectChanges();
1186+
expect(cell.editMode).toBeTruthy();
1187+
expect(cell.editValue).toBe('Test');
1188+
});
11681189
});
11691190

11701191
describe('Integration tests', () => {

0 commit comments

Comments
 (0)