Skip to content

Commit bdab162

Browse files
fix: datatable-scroller width should update on recalculate (#79)
1 parent bff1034 commit bdab162

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

projects/ngx-datatable/src/lib/components/body/body.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ export class DataTableBodyComponent implements OnInit, OnDestroy {
269269
@Input() set columns(val: any[]) {
270270
if (val !== this._columns) {
271271
this._columns = val;
272-
const colsByPin = columnsByPin(val);
273-
this.columnGroupWidths = columnGroupWidths(colsByPin, val);
272+
this.updateColumnGroupWidths();
274273
}
275274
}
276275

@@ -1012,4 +1011,9 @@ export class DataTableBodyComponent implements OnInit, OnDestroy {
10121011
this._draggedRow = undefined;
10131012
this._draggedRowElement = undefined;
10141013
}
1014+
1015+
updateColumnGroupWidths() {
1016+
const colsByPin = columnsByPin(this._columns);
1017+
this.columnGroupWidths = columnGroupWidths(colsByPin, this._columns);
1018+
}
10151019
}

projects/ngx-datatable/src/lib/components/datatable.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,11 @@ export class DatatableComponent implements OnInit, DoCheck, AfterViewInit, After
940940
adjustColumnWidths(columns, width);
941941
}
942942

943+
if (this.bodyComponent) {
944+
this.bodyComponent.updateColumnGroupWidths();
945+
this.bodyComponent.cd.markForCheck();
946+
}
947+
943948
return columns;
944949
}
945950

0 commit comments

Comments
 (0)