Skip to content

Commit

Permalink
fix(primeng/pEditableColumn): update column data in runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
volvachev committed Sep 23, 2023
1 parent 396297a commit 7b8f140
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3926,7 +3926,7 @@ export class ReorderableColumn implements AfterViewInit, OnDestroy {
class: 'p-element'
}
})
export class EditableColumn implements AfterViewInit, OnDestroy {
export class EditableColumn implements OnChanges, AfterViewInit, OnDestroy {
@Input('pEditableColumn') data: any;

@Input('pEditableColumnField') field: any;
Expand All @@ -3941,6 +3941,12 @@ export class EditableColumn implements AfterViewInit, OnDestroy {

constructor(public dt: Table, public el: ElementRef, public zone: NgZone) {}

public ngOnChanges({ data }: SimpleChanges): void {
if (this.el.nativeElement && !data.firstChange) {
this.dt.updateEditingCell(this.el.nativeElement, this.data, this.field, <number>this.rowIndex);
}
}

ngAfterViewInit() {
if (this.isEnabled()) {
DomHandler.addClass(this.el.nativeElement, 'p-editable-column');
Expand Down

1 comment on commit 7b8f140

@depmoddima
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! You killed the option to undo changes via pressing Esc, dude ((

Please sign in to comment.