Skip to content

Commit 5b4ca17

Browse files
kseamonandrewseguin
authored andcommitted
fix(cdk/table): Column sizing and scrolling bug when number of columns in table changes (#30378)
Part of fix includes cdk-experimental/column-resize. See internal issue 390466445. (cherry picked from commit 8950ec3)
1 parent b683474 commit 5b4ca17

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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)