From f718524ee7ec09219f366f66a1f79711f044345b Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Fri, 18 Jan 2019 12:19:19 +0000 Subject: [PATCH] mgr/dashboard: Fix TableComponent when changing columns afterViewInit Angular was throwing an ExpressionChangedAfterItHasBeenCheckedError if you changed columns information right after the table was initiated. Signed-off-by: Tiago Melo --- .../src/app/shared/datatable/table/table.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index 053b1fae719..19ba5e427ee 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -1,5 +1,6 @@ import { AfterContentChecked, + ChangeDetectorRef, Component, EventEmitter, Input, @@ -159,7 +160,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O // table columns after the browser window has been resized. private currentWidth: number; - constructor(private ngZone: NgZone) {} + constructor(private ngZone: NgZone, private cdRef: ChangeDetectorRef) {} ngOnInit() { this._addTemplates(); @@ -451,6 +452,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O this.table.onColumnSort({ sorts: this.userConfig.sorts }); } this.table.recalculate(); + this.cdRef.detectChanges(); } createSortingDefinition(prop: TableColumnProp): SortPropDir[] { -- 2.47.3