Skip to content

Commit 443a1a1

Browse files
committed
chore(*): replace the check the in movePrevious/moveNext methods
1 parent fd6c02f commit 443a1a1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

projects/igniteui-angular/src/lib/grids/grid-navigation.service.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,30 +168,29 @@ export class IgxGridNavigationService {
168168

169169
public movePreviousEditable(rowIndex: number, currentColumnVisibleIndex: number) {
170170
const prevEditableColumnIndex = this.findNextEditable(MoveDirection.LEFT, currentColumnVisibleIndex - 1);
171-
if (prevEditableColumnIndex === -1 && this.grid.rowEditTabs.length) {
171+
if (prevEditableColumnIndex === -1) {
172172
// TODO: make gridAPI visible for internal use and remove cast to any
173173
(this.grid as any).gridAPI.submit_value();
174-
this.grid.rowEditTabs.last.element.nativeElement.focus();
174+
if (this.grid.rowEditTabs.length) { this.grid.rowEditTabs.last.element.nativeElement.focus(); }
175175
return;
176176
}
177177
this.focusEditableTarget(rowIndex, prevEditableColumnIndex);
178178
}
179179

180180
public moveNextEditable(rowIndex: number, currentColumnVisibleIndex: number) {
181181
const nextEditableColumnIndex = this.findNextEditable(MoveDirection.RIGHT, currentColumnVisibleIndex + 1);
182-
if (nextEditableColumnIndex === -1 && this.grid.rowEditTabs.length) {
182+
if (nextEditableColumnIndex === -1) {
183183
// TODO: make gridAPI visible for internal use and remove cast to any
184184
(this.grid as any).gridAPI.submit_value();
185-
this.grid.rowEditTabs.first.element.nativeElement.focus();
185+
if ( this.grid.rowEditTabs.length) { this.grid.rowEditTabs.first.element.nativeElement.focus(); }
186186
return;
187187
}
188188
this.focusEditableTarget(rowIndex, nextEditableColumnIndex);
189189
}
190190

191191
public focusEditableTarget(rowIndex: number, columnIndex: number) {
192192
if (this.isColumnFullyVisible(columnIndex)) {
193-
const cell = this.getCellElementByVisibleIndex(rowIndex, columnIndex);
194-
if (cell) { cell.focus(); }
193+
this.getCellElementByVisibleIndex(rowIndex, columnIndex).focus();
195194
} else {
196195
this.performHorizontalScrollToCell(rowIndex, columnIndex);
197196
}

0 commit comments

Comments
 (0)