Skip to content

Commit

Permalink
fix(IgxGridCell): focus input when enter cell in edit mode #2801
Browse files Browse the repository at this point in the history
ddincheva committed Dec 18, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 471faae commit 18b62b1
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions projects/igniteui-angular/src/lib/grids/cell.component.ts
Original file line number Diff line number Diff line change
@@ -287,6 +287,7 @@ export class IgxGridCellComponent implements OnInit, AfterViewInit {
return;
}
if (this.column.editable && value) {
this.focused = true;
this.gridAPI.set_cell_inEditMode(this.gridID, this);
if (this.highlight && this.grid.lastSearchInfo.searchText) {
this.highlight.observe();
@@ -538,6 +539,10 @@ export class IgxGridCellComponent implements OnInit, AfterViewInit {
this.selected = true;
if (fireFocus) {
this.nativeElement.focus();
} else {
if (!this.focused) {
this.focused = this.nativeElement === document.activeElement;
}
}
this.grid.onSelection.emit({ cell: this, event });
}
@@ -842,8 +847,8 @@ export class IgxGridCellComponent implements OnInit, AfterViewInit {
}

public onKeydownExitEditMode(event) {
if (this.column.editable) {
const editableCell = this.gridAPI.get_cell_inEditMode(this.gridID);
const editableCell = this.gridAPI.get_cell_inEditMode(this.gridID);
if (this.column.editable && editableCell) {
const args: IGridEditEventArgs = {
cellID: editableCell.cellID,
rowID: editableCell.cellID.rowID,
Original file line number Diff line number Diff line change
@@ -1793,11 +1793,12 @@ describe('IgxGrid Component Tests', () => {

const targetCell = grid.getCellByColumn(0, 'ProductName');
targetCell.onFocus({});
tick();
tick(100);
fixture.detectChanges();
expect(grid.endRowTransaction).toHaveBeenCalledTimes(1);
expect(targetCell.focused).toBeTruthy();
expect(firstCell.focused).toBeFalsy();
expect(targetCell.selected).toBeTruthy();
expect(firstCell.selected).toBeFalsy();
}));
});

0 comments on commit 18b62b1

Please sign in to comment.