Skip to content

Commit 8e3435f

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Prevent adding if grid rowEditable is false. Also add check in case there are no editable cells.
1 parent 0154e75 commit 8e3435f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4064,6 +4064,9 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
40644064
* @hidden @internal
40654065
*/
40664066
public beginAddRowByIndex(rowID: any, index: number, asChild?: boolean) {
4067+
if (!this.rowEditable) {
4068+
return;
4069+
}
40674070
this.endEdit(true);
40684071
this.cancelAddMode = false;
40694072
const isInPinnedArea = this.isRecordPinnedByViewIndex(index);
@@ -4084,8 +4087,10 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
40844087
this.cdr.detectChanges();
40854088
const row = this.getRowByIndex(index + 1);
40864089
const cell = row.cells.find(c => c.editable);
4087-
cell.setEditMode(true);
4088-
cell.activate();
4090+
if (cell) {
4091+
cell.setEditMode(true);
4092+
cell.activate();
4093+
}
40894094
}
40904095

40914096
/**

0 commit comments

Comments
 (0)