From 7b8f140aedf3fe325edcdbc6ab3171695ccd871f Mon Sep 17 00:00:00 2001 From: Egor Volvachev Date: Sat, 23 Sep 2023 18:42:36 +0300 Subject: [PATCH] fix(primeng/pEditableColumn): update column data in runtime Fixes #13708. --- src/app/components/table/table.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index a4114524906..7f0a66a091b 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -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; @@ -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, this.rowIndex); + } + } + ngAfterViewInit() { if (this.isEnabled()) { DomHandler.addClass(this.el.nativeElement, 'p-editable-column');