Skip to content

Commit 2efbff3

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

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
@@ -904,6 +904,19 @@ export class IgxForOfDirective<T, U extends T[] = T[]> implements OnInit, OnChan
904904
}
905905
}
906906

907+
908+
/**
909+
* @hidden
910+
* @internal
911+
*/
912+
public updateScroll(): void {
913+
if (this.igxForScrollOrientation === "horizontal") {
914+
const scrollAmount = this.scrollComponent.nativeElement["scrollLeft"];
915+
this.scrollComponent.scrollAmount = scrollAmount;
916+
this._updateScrollOffset();
917+
}
918+
}
919+
907920
protected updateSizes() {
908921
if (!this.scrollComponent.nativeElement.isConnected) return;
909922
const scrollable = this.isScrollable();
@@ -1614,11 +1627,6 @@ export class IgxGridForOfDirective<T, U extends T[] = T[]> extends IgxForOfDirec
16141627
const containerSize = 'igxForContainerSize';
16151628
if (containerSize in changes && !changes[containerSize].firstChange && this.igxForOf) {
16161629
this._recalcOnContainerChange();
1617-
if (changes[containerSize].previousValue && this.igxForScrollOrientation === "horizontal") {
1618-
const scrollAmount = this.scrollComponent.nativeElement["scrollLeft"];
1619-
this.scrollComponent.scrollAmount = scrollAmount;
1620-
this._updateScrollOffset();
1621-
}
16221630
}
16231631
}
16241632

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3592,6 +3592,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
35923592
// the vert. scrollbar showing/hiding
35933593
this.notifyChanges(true);
35943594
this.cdr.detectChanges();
3595+
Promise.resolve().then(() => this.headerContainer.updateScroll());
35953596
});
35963597

35973598
this.verticalScrollContainer.contentSizeChange.pipe(filter(() => !this._init), throttleTime(30), destructor).subscribe(() => {

0 commit comments

Comments
 (0)