Skip to content

Commit e78229a

Browse files
authored
Merge pull request #3110 from IgniteUI/crud-sample-fi
branch the logic inside rowEditDone
2 parents ca3b103 + 5086629 commit e78229a

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/app/grid/grid-crud-sample/crud-sample.component.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ export class CRUDSampleComponent implements OnInit, OnDestroy {
4747
});
4848
}
4949

50-
public rowAdded(event: IRowDataEventArgs) {
50+
public rowAdded(event: IRowDataEventArgs): void {
5151
this._crudService.add(event.data).subscribe((rec) => {
5252
// this.snackbar.open(`Row with ID of ${rec.ID} was created.`);
5353
});
5454
}
5555

56-
public rowDeleted(event: IRowDataEventArgs) {
56+
public rowDeleted(event: IRowDataEventArgs): void {
5757
this.grid.isLoading = true;
5858
this._crudService.delete(event.data).subscribe({
5959
next: (data: any) => {
@@ -69,12 +69,15 @@ export class CRUDSampleComponent implements OnInit, OnDestroy {
6969
});
7070
}
7171

72-
public rowEditDone(event: IGridEditDoneEventArgs) {
73-
this.grid.isLoading = true;
74-
this._crudService.update(event.newValue).subscribe((rec) => {
75-
this.grid.isLoading = false;
76-
this.snackbar.open(`Row with ID of ${rec.ID} was edited.`);
77-
});
72+
public rowEditDone(event: IGridEditDoneEventArgs): void {
73+
if (!event.isAddRow) {
74+
this.grid.isLoading = true;
75+
this._crudService.update(event.newValue).subscribe((rec) => {
76+
this.grid.isLoading = false;
77+
this.snackbar.open(`Row with ID of ${rec.ID} was edited.`);
78+
});
79+
}
80+
7881
}
7982

8083
public removeRow(row: IgxGridRow) {

0 commit comments

Comments
 (0)