diff --git a/src/cdk-experimental/column-resize/resize-strategy.ts b/src/cdk-experimental/column-resize/resize-strategy.ts index a37ea5db0b43..372e35baa659 100644 --- a/src/cdk-experimental/column-resize/resize-strategy.ts +++ b/src/cdk-experimental/column-resize/resize-strategy.ts @@ -65,6 +65,11 @@ export abstract class ResizeStrategy implements OnDestroy { }); this.styleScheduler.scheduleEnd(() => { + // Once the column sizes have updated, we unset the table width so that + // it does not have unwanted side effects on future changes in the table + // such as columns being added or removed. + tableElement.style.width = ''; + this.table.updateStickyColumnStyles(); }); } diff --git a/src/cdk/table/sticky-styler.ts b/src/cdk/table/sticky-styler.ts index cdf8a9569803..eebe0b8ec3ea 100644 --- a/src/cdk/table/sticky-styler.ts +++ b/src/cdk/table/sticky-styler.ts @@ -185,7 +185,7 @@ export class StickyStyler { } } - if (this._positionListener) { + if (this._positionListener && cellWidths.some(w => !!w)) { this._positionListener.stickyColumnsUpdated({ sizes: lastStickyStart === -1