@@ -597,7 +597,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
597
597
} else {
598
598
this . _bScrollInternal = false ;
599
599
}
600
-
600
+ const prevStartIndex = this . state . startIndex ;
601
601
const scrollOffset = this . fixedUpdateAllRows ( this . _virtScrollTop ) ;
602
602
603
603
this . dc . instance . _viewContainer . element . nativeElement . style . top = - ( scrollOffset ) + 'px' ;
@@ -607,8 +607,9 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
607
607
this . recalcUpdateSizes ( ) ;
608
608
} ) ;
609
609
this . dc . changeDetectorRef . detectChanges ( ) ;
610
-
611
- this . onChunkLoad . emit ( this . state ) ;
610
+ if ( prevStartIndex !== this . state . startIndex ) {
611
+ this . onChunkLoad . emit ( this . state ) ;
612
+ }
612
613
}
613
614
614
615
/**
@@ -735,13 +736,15 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
735
736
return ;
736
737
}
737
738
const curScrollLeft = event . target . scrollLeft ;
738
-
739
+ const prevStartIndex = this . state . startIndex ;
739
740
// Updating horizontal chunks
740
741
const scrollOffset = this . fixedUpdateAllCols ( curScrollLeft ) ;
741
742
this . dc . instance . _viewContainer . element . nativeElement . style . left = - scrollOffset + 'px' ;
742
743
743
744
this . dc . changeDetectorRef . detectChanges ( ) ;
744
- this . onChunkLoad . emit ( ) ;
745
+ if ( prevStartIndex !== this . state . startIndex ) {
746
+ this . onChunkLoad . emit ( this . state ) ;
747
+ }
745
748
}
746
749
747
750
/**
@@ -753,7 +756,10 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
753
756
this . sizesCache ,
754
757
0
755
758
) ;
756
- this . onChunkPreload . emit ( this . state ) ;
759
+ const bUpdatedStart = this . state . startIndex !== startIndex ;
760
+ if ( bUpdatedStart ) {
761
+ this . onChunkPreload . emit ( this . state ) ;
762
+ }
757
763
/*recalculate and apply page size.*/
758
764
if ( startIndex + this . state . chunkSize > this . igxForOf . length ) {
759
765
this . state . startIndex = this . igxForOf . length - this . state . chunkSize ;
@@ -805,6 +811,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
805
811
* @hidden
806
812
*/
807
813
protected _applyChanges ( changes : IterableChanges < T > ) {
814
+ const prevChunkSize = this . state . chunkSize ;
808
815
this . applyChunkSizeChange ( ) ;
809
816
this . _recalcScrollBarSize ( ) ;
810
817
if ( this . igxForOf && this . igxForOf . length && this . dc ) {
@@ -823,7 +830,9 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
823
830
cntx . index = this . igxForOf . indexOf ( input ) ;
824
831
}
825
832
this . dc . changeDetectorRef . detectChanges ( ) ;
826
- this . onChunkLoad . emit ( ) ;
833
+ if ( prevChunkSize !== this . state . chunkSize ) {
834
+ this . onChunkLoad . emit ( this . state ) ;
835
+ }
827
836
if ( this . igxForScrollOrientation === 'vertical' ) {
828
837
this . recalcUpdateSizes ( ) ;
829
838
}
@@ -1009,8 +1018,12 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
1009
1018
protected _recalcOnContainerChange ( changes : SimpleChanges ) {
1010
1019
this . dc . instance . _viewContainer . element . nativeElement . style . top = '0px' ;
1011
1020
this . dc . instance . _viewContainer . element . nativeElement . style . left = '0px' ;
1021
+ const prevChunkSize = this . state . chunkSize ;
1012
1022
this . applyChunkSizeChange ( ) ;
1013
1023
this . _recalcScrollBarSize ( ) ;
1024
+ if ( prevChunkSize !== this . state . chunkSize ) {
1025
+ this . onChunkLoad . emit ( this . state ) ;
1026
+ }
1014
1027
if ( this . sizesCache && this . hScroll && this . hScroll . scrollLeft !== 0 ) {
1015
1028
// Updating horizontal chunks and offsets based on the new scrollLeft
1016
1029
const scrollOffset = this . fixedUpdateAllCols ( this . hScroll . scrollLeft ) ;
@@ -1222,6 +1235,7 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
1222
1235
}
1223
1236
1224
1237
protected _applyChanges ( changes : IterableChanges < T > ) {
1238
+ const prevChunkSize = this . state . chunkSize ;
1225
1239
this . applyChunkSizeChange ( ) ;
1226
1240
this . _recalcScrollBarSize ( ) ;
1227
1241
if ( this . igxForOf && this . igxForOf . length && this . dc ) {
@@ -1239,6 +1253,9 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
1239
1253
cntx . $implicit = input ;
1240
1254
cntx . index = this . igxForOf . indexOf ( input ) ;
1241
1255
}
1256
+ if ( prevChunkSize !== this . state . chunkSize ) {
1257
+ this . onChunkLoad . emit ( this . state ) ;
1258
+ }
1242
1259
if ( this . igxForScrollOrientation === 'vertical' ) {
1243
1260
requestAnimationFrame ( ( ) => {
1244
1261
this . recalcUpdateSizes ( ) ;
0 commit comments