@@ -1846,8 +1846,7 @@ export abstract class IgxGridBaseDirective implements GridType,
1846
1846
1847
1847
@HostBinding ( 'attr.aria-rowcount' )
1848
1848
protected get ariaRowCount ( ) : number {
1849
- const totalRows = ( this as any ) . totalItemCount ?? this . data ?. length ?? 0 ;
1850
- return ( this . paginator ? this . _totalRecords : totalRows ) + 1 ;
1849
+ return this . _rendered ? this . _rowCount : null ;
1851
1850
}
1852
1851
1853
1852
/**
@@ -3309,6 +3308,7 @@ export abstract class IgxGridBaseDirective implements GridType,
3309
3308
private _sortDescendingHeaderIconTemplate : TemplateRef < IgxGridHeaderTemplateContext > = null ;
3310
3309
private _gridSize : Size = Size . Large ;
3311
3310
private _defaultRowHeight = 50 ;
3311
+ private _rowCount : number ;
3312
3312
3313
3313
/**
3314
3314
* @hidden @internal
@@ -4130,6 +4130,7 @@ export abstract class IgxGridBaseDirective implements GridType,
4130
4130
if ( this . hasColumnsToAutosize ) {
4131
4131
this . autoSizeColumnsInView ( ) ;
4132
4132
}
4133
+ this . _calculateRowCount ( ) ;
4133
4134
this . _rendered = true ;
4134
4135
} ) ;
4135
4136
Promise . resolve ( ) . then ( ( ) => this . rendered . next ( true ) ) ;
@@ -6772,6 +6773,7 @@ export abstract class IgxGridBaseDirective implements GridType,
6772
6773
6773
6774
this . initColumns ( this . _columns , ( col : IgxColumnComponent ) => this . columnInit . emit ( col ) ) ;
6774
6775
this . columnListDiffer . diff ( this . columnList ) ;
6776
+ this . _calculateRowCount ( ) ;
6775
6777
6776
6778
this . columnList . changes
6777
6779
. pipe ( takeUntil ( this . destroy$ ) )
@@ -7995,4 +7997,15 @@ export abstract class IgxGridBaseDirective implements GridType,
7995
7997
return recreateTreeFromFields ( value , this . _columns ) as IFilteringExpressionsTree ;
7996
7998
}
7997
7999
}
8000
+
8001
+ private _calculateRowCount ( ) : void {
8002
+ if ( this . verticalScrollContainer ?. isRemote ) {
8003
+ this . _rowCount = this . verticalScrollContainer . totalItemCount ?? 0 ;
8004
+ } else if ( this . paginator ) {
8005
+ this . _rowCount = this . totalRecords ?? 0 ;
8006
+ } else {
8007
+ this . _rowCount = this . verticalScrollContainer ?. igxForOf ?. length ?? 0 ;
8008
+ }
8009
+ this . _rowCount += 1 ; // include header row
8010
+ }
7998
8011
}
0 commit comments