@@ -1413,14 +1413,17 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
1413
1413
}
1414
1414
1415
1415
1416
- private _adjustScrollPositionAfterSizeChange ( sizeDiff ) {
1416
+ protected _adjustScrollPositionAfterSizeChange ( sizeDiff ) {
1417
1417
// if data has been changed while container is scrolled
1418
1418
// should update scroll top/left according to change so that same startIndex is in view
1419
1419
if ( Math . abs ( sizeDiff ) > 0 && this . scrollPosition > 0 ) {
1420
1420
this . recalcUpdateSizes ( ) ;
1421
1421
const offset = parseInt ( this . dc . instance . _viewContainer . element . nativeElement . style . top , 10 ) ;
1422
1422
const newSize = this . sizesCache [ this . state . startIndex ] - offset ;
1423
- this . scrollPosition = newSize === this . scrollPosition ? newSize + 1 : newSize ;
1423
+ this . scrollPosition = newSize ;
1424
+ if ( this . scrollPosition !== newSize ) {
1425
+ this . scrollComponent . scrollAmount = newSize ;
1426
+ }
1424
1427
}
1425
1428
}
1426
1429
@@ -1575,8 +1578,11 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
1575
1578
}
1576
1579
this . syncService . setMaster ( this ) ;
1577
1580
this . igxForContainerSize = args . containerSize ;
1578
- this . _updateSizeCache ( changes ) ;
1581
+ const sizeDiff = this . _updateSizeCache ( changes ) ;
1579
1582
this . _applyChanges ( ) ;
1583
+ if ( sizeDiff ) {
1584
+ this . _adjustScrollPositionAfterSizeChange ( sizeDiff ) ;
1585
+ }
1580
1586
this . _updateScrollOffset ( ) ;
1581
1587
this . dataChanged . emit ( ) ;
1582
1588
}
@@ -1681,6 +1687,7 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
1681
1687
}
1682
1688
} ) ;
1683
1689
}
1690
+ return diff ;
1684
1691
}
1685
1692
1686
1693
protected handleCacheChanges ( changes : IterableChanges < T > ) {
0 commit comments