Skip to content

Commit efb9cf8

Browse files
authored
Merge branch 'master' into simeonoff/fix-10516
2 parents b0fe217 + 6ed5a11 commit efb9cf8

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/app/grid-column-selection/grid-column-selection.sample.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ViewChild, OnInit, Pipe, PipeTransform } from '@angular/core';
1+
import { Component, ViewChild, OnInit, Pipe, PipeTransform, AfterViewInit, ChangeDetectorRef } from '@angular/core';
22
import {
33
IgxGridComponent,
44
OverlaySettings,
@@ -21,7 +21,7 @@ import { SAMPLE_DATA } from '../shared/sample-data';
2121
templateUrl: 'grid-column-selection.sample.html'
2222
})
2323

24-
export class GridColumnSelectionSampleComponent implements OnInit {
24+
export class GridColumnSelectionSampleComponent implements OnInit, AfterViewInit {
2525
@ViewChild('grid1', { static: true }) public grid1: IgxGridComponent;
2626
@ViewChild('grid', { static: true }) public grid: IgxGridComponent;
2727

@@ -64,10 +64,16 @@ export class GridColumnSelectionSampleComponent implements OnInit {
6464
closeOnOutsideClick: true
6565
};
6666

67+
constructor(private cdr: ChangeDetectorRef) {}
68+
6769
public log(event) {
6870
console.log(event);
6971
}
7072

73+
public ngAfterViewInit() {
74+
this.cdr.detectChanges();
75+
}
76+
7177
public ngOnInit(): void {
7278
this.displayDensities = [
7379
{ label: 'comfortable', selected: this.density === 'comfortable', togglable: true },

src/app/grid/grid.sample.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,13 @@ export class GridSampleComponent implements OnInit, AfterViewInit {
172172
}
173173

174174
public deleteRow() {
175-
this.selectedRow = Object.assign({}, this.selectedCell.Row);
176-
this.grid1.deleteRow(this.selectedCell.rowIndex);
177-
this.selectedCell = {};
178-
this.snax.open(`Row with ID ${this.selectedRow.record.ID} was deleted`);
175+
if (this.selectedCell.cell) {
176+
const rowIndex = this.selectedCell.cell.row.index;
177+
const row = this.grid1.getRowByIndex(rowIndex);
178+
row.delete();
179+
this.snax.open(`Row with ID ${rowIndex} was deleted`);
180+
this.selectedCell = {};
181+
}
179182
}
180183

181184
public restore() {

0 commit comments

Comments
 (0)