@@ -546,7 +546,9 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
546
546
}
547
547
const containerSize = 'igxForContainerSize' ;
548
548
if ( containerSize in changes && ! changes [ containerSize ] . firstChange && this . igxForOf ) {
549
- this . _recalcOnContainerChange ( ) ;
549
+ const prevSize = parseInt ( changes [ containerSize ] . previousValue , 10 ) ;
550
+ const newSize = parseInt ( changes [ containerSize ] . currentValue , 10 ) ;
551
+ this . _recalcOnContainerChange ( { prevSize, newSize} ) ;
550
552
}
551
553
}
552
554
@@ -1316,24 +1318,25 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
1316
1318
return end ;
1317
1319
}
1318
1320
1319
- protected _recalcScrollBarSize ( ) {
1321
+ protected _recalcScrollBarSize ( containerSizeInfo = null ) {
1320
1322
const count = this . isRemote ? this . totalItemCount : ( this . igxForOf ? this . igxForOf . length : 0 ) ;
1321
1323
this . dc . instance . notVirtual = ! ( this . igxForContainerSize && this . dc && this . state . chunkSize < count ) ;
1322
- const scrollable = this . isScrollable ( ) ;
1324
+ const scrollable = containerSizeInfo ? this . scrollComponent . size > containerSizeInfo . prevSize : this . isScrollable ( ) ;
1323
1325
if ( this . igxForScrollOrientation === 'horizontal' ) {
1324
1326
const totalWidth = parseInt ( this . igxForContainerSize , 10 ) > 0 ? this . _calcSize ( ) : 0 ;
1325
- this . scrollComponent . nativeElement . style . width = this . igxForContainerSize + 'px' ;
1326
- this . scrollComponent . size = totalWidth ;
1327
1327
if ( totalWidth <= parseInt ( this . igxForContainerSize , 10 ) ) {
1328
1328
this . resetScrollPosition ( ) ;
1329
1329
}
1330
+ this . scrollComponent . nativeElement . style . width = this . igxForContainerSize + 'px' ;
1331
+ this . scrollComponent . size = totalWidth ;
1330
1332
}
1331
1333
if ( this . igxForScrollOrientation === 'vertical' ) {
1332
- this . scrollComponent . nativeElement . style . height = parseInt ( this . igxForContainerSize , 10 ) + 'px' ;
1333
- this . scrollComponent . size = this . _calcSize ( ) ;
1334
- if ( this . scrollComponent . size <= parseInt ( this . igxForContainerSize , 10 ) ) {
1334
+ const totalHeight = this . _calcSize ( ) ;
1335
+ if ( totalHeight <= parseInt ( this . igxForContainerSize , 10 ) ) {
1335
1336
this . resetScrollPosition ( ) ;
1336
1337
}
1338
+ this . scrollComponent . nativeElement . style . height = parseInt ( this . igxForContainerSize , 10 ) + 'px' ;
1339
+ this . scrollComponent . size = totalHeight ;
1337
1340
}
1338
1341
if ( scrollable !== this . isScrollable ( ) ) {
1339
1342
// scrollbar visibility has changed
@@ -1356,10 +1359,10 @@ export class IgxForOfDirective<T, U extends T[] = T[]> extends IgxForOfToken<T,U
1356
1359
return size ;
1357
1360
}
1358
1361
1359
- protected _recalcOnContainerChange ( ) {
1362
+ protected _recalcOnContainerChange ( containerSizeInfo = null ) {
1360
1363
const prevChunkSize = this . state . chunkSize ;
1361
1364
this . applyChunkSizeChange ( ) ;
1362
- this . _recalcScrollBarSize ( ) ;
1365
+ this . _recalcScrollBarSize ( containerSizeInfo ) ;
1363
1366
if ( prevChunkSize !== this . state . chunkSize ) {
1364
1367
this . chunkLoad . emit ( this . state ) ;
1365
1368
}
@@ -1616,7 +1619,9 @@ export class IgxGridForOfDirective<T, U extends T[] = T[]> extends IgxForOfDirec
1616
1619
}
1617
1620
const containerSize = 'igxForContainerSize' ;
1618
1621
if ( containerSize in changes && ! changes [ containerSize ] . firstChange && this . igxForOf ) {
1619
- this . _recalcOnContainerChange ( ) ;
1622
+ const prevSize = parseInt ( changes [ containerSize ] . previousValue , 10 ) ;
1623
+ const newSize = parseInt ( changes [ containerSize ] . currentValue , 10 ) ;
1624
+ this . _recalcOnContainerChange ( { prevSize, newSize} ) ;
1620
1625
}
1621
1626
}
1622
1627
0 commit comments