Skip to content

Commit

Permalink
Merge pull request #13719 from volvachev/fix-editable-column
Browse files Browse the repository at this point in the history
fix(primeng/pEditableColumn): update column data in runtime
  • Loading branch information
cetincakiroglu authored Nov 8, 2023
2 parents 2bb832a + 7b8f140 commit e590572
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 @@ -3942,7 +3942,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 @@ -3957,6 +3957,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 e590572

@vercel
Copy link

@vercel vercel bot commented on e590572 Nov 8, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.