Skip to content

Commit 3be96ab

Browse files
MKirovaMayaKirova
authored andcommitted
chore(*): Attempt a more targeted fix for misalignment when data is changed and scrollbar hides.
1 parent 2e29d73 commit 3be96ab

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,19 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
924924
}
925925
}
926926

927+
928+
/**
929+
* @hidden
930+
* @internal
931+
*/
932+
public updateScroll(): void {
933+
if (this.igxForScrollOrientation === "horizontal") {
934+
const scrollAmount = this.scrollComponent.nativeElement["scrollLeft"];
935+
this.scrollComponent.scrollAmount = scrollAmount;
936+
this._updateScrollOffset();
937+
}
938+
}
939+
927940
protected updateSizes() {
928941
if (!this.scrollComponent.nativeElement.isConnected) return;
929942
const scrollable = this.isScrollable();
@@ -1627,11 +1640,6 @@ export class IgxGridForOfDirective<T, U extends T[] = T[]> extends IgxForOfDirec
16271640
const prevSize = parseInt(changes[containerSize].previousValue, 10);
16281641
const newSize = parseInt(changes[containerSize].currentValue, 10);
16291642
this._recalcOnContainerChange({prevSize, newSize});
1630-
if (changes[containerSize].previousValue && this.igxForScrollOrientation === "horizontal") {
1631-
const scrollAmount = this.scrollComponent.nativeElement["scrollLeft"];
1632-
this.scrollComponent.scrollAmount = scrollAmount;
1633-
this._updateScrollOffset();
1634-
}
16351643
}
16361644
}
16371645

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3628,6 +3628,7 @@ export abstract class IgxGridBaseDirective implements GridType,
36283628
// the vert. scrollbar showing/hiding
36293629
this.notifyChanges(true);
36303630
this.cdr.detectChanges();
3631+
Promise.resolve().then(() => this.headerContainer.updateScroll());
36313632
});
36323633

36333634

0 commit comments

Comments
 (0)