Skip to content

Commit 7e40671

Browse files
authored
Merge pull request #15995 from IgniteUI/dkamburov/fix-37933
fix(grid): Cancel endEdit if there is no active editing
2 parents 8911970 + f9403e6 commit 7e40671

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6349,6 +6349,9 @@ export abstract class IgxGridBaseDirective implements GridType,
63496349
// TODO: do not remove this, as it is used in rowEditTemplate, but mark is as internal and hidden
63506350
/* blazorCSSuppress */
63516351
public endEdit(commit = true, event?: Event): boolean {
6352+
if (!this.crudService.cellInEditMode && !this.crudService.rowInEditMode) {
6353+
return;
6354+
}
63526355
const document = this.nativeElement?.getRootNode() as Document | ShadowRoot;
63536356
const focusWithin = this.nativeElement?.contains(document.activeElement);
63546357

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ describe('IgxGrid - Cell selection #grid', () => {
8484

8585
UIInteractions.simulatePointerOverElementEvent('pointerup', endCell.nativeElement);
8686
detect();
87+
// Invoke endEdit() to make sure if no editing is going on,
88+
// the cell activation shouldn't be lost (https://infragistics.visualstudio.com/Indigo_Platform/_workitems/edit/37933)
89+
grid.endEdit(true, null);
90+
fix.detectChanges();
8791

8892
expect(startCell.active).toBe(true);
8993
GridSelectionFunctions.verifyCellsRegionSelected(grid, 2, 3, 1, 0);

0 commit comments

Comments
 (0)