Skip to content

Commit 8950ec3

Browse files
authored
fix(cdk/table): Column sizing and scrolling bug when number of columns in table changes (angular#30378)
Part of fix includes cdk-experimental/column-resize. See internal issue 390466445.
1 parent e91d509 commit 8950ec3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/cdk-experimental/column-resize/resize-strategy.ts

+5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ export abstract class ResizeStrategy implements OnDestroy {
6565
});
6666

6767
this.styleScheduler.scheduleEnd(() => {
68+
// Once the column sizes have updated, we unset the table width so that
69+
// it does not have unwanted side effects on future changes in the table
70+
// such as columns being added or removed.
71+
tableElement.style.width = '';
72+
6873
this.table.updateStickyColumnStyles();
6974
});
7075
}

src/cdk/table/sticky-styler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class StickyStyler {
185185
}
186186
}
187187

188-
if (this._positionListener) {
188+
if (this._positionListener && cellWidths.some(w => !!w)) {
189189
this._positionListener.stickyColumnsUpdated({
190190
sizes:
191191
lastStickyStart === -1

0 commit comments

Comments
 (0)