From d97749a147064c0a4c1e16c9a662de8fd3c7ae1a Mon Sep 17 00:00:00 2001 From: Daniel Schreiber Date: Thu, 19 Sep 2019 18:14:29 +0200 Subject: [PATCH] fix(table): show pin mode shadow with OnPush change detection (#179) Closes #177 --- .../angular-public/table/src/table/table.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/sbb-esta/angular-public/table/src/table/table.component.ts b/projects/sbb-esta/angular-public/table/src/table/table.component.ts index 9e0a1b8c56..343e935d01 100644 --- a/projects/sbb-esta/angular-public/table/src/table/table.component.ts +++ b/projects/sbb-esta/angular-public/table/src/table/table.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, + ChangeDetectorRef, Component, HostBinding, Input, @@ -69,7 +70,7 @@ export class TableComponent implements OnChanges, OnDestroy { private _scrollListener = new Subject(); - constructor(private _zone: NgZone) {} + constructor(private _zone: NgZone, private _changeDetectorRef: ChangeDetectorRef) {} ngOnChanges(changes: SimpleChanges): void { if (!stickySupported) { @@ -87,7 +88,12 @@ export class TableComponent implements OnChanges, OnDestroy { takeUntil(this._scrollListener), distinctUntilChanged() ) - .subscribe(v => this._zone.run(() => (this._scrolling = v))); + .subscribe(v => + this._zone.run(() => { + this._scrolling = v; + this._changeDetectorRef.markForCheck(); + }) + ); } else if ( changes.pinMode.currentValue === 'off' && changes.pinMode.previousValue !== changes.pinMode.currentValue