File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed
projects/ngx-datatable/src/lib/components Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change 4242 [ghostLoadingIndicator] ="ghostLoadingIndicator() "
4343 [externalPaging] ="externalPaging() "
4444 [rowHeight] ="rowHeight() "
45- [rowCount] ="rowCount "
45+ [rowCount] ="rowCount() "
4646 [offset] ="offset "
4747 [trackByProp] ="trackByProp() "
4848 [columns] ="_internalColumns() "
9494 </ div >
9595 @if (footerHeight()) {
9696 < datatable-footer
97- [rowCount] ="_internalGroupedRows() !== undefined ? _internalRows().length : rowCount "
98- [groupCount] ="_internalGroupedRows() !== undefined ? rowCount : undefined "
97+ [rowCount] ="_internalGroupedRows() !== undefined ? _internalRows().length : rowCount() "
98+ [groupCount] ="_internalGroupedRows() !== undefined ? rowCount() : undefined "
9999 [pageSize] ="pageSize "
100100 [offset] ="offset "
101101 [footerHeight] ="footerHeight() "
Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ export class DatatableComponent<TRow extends Row = any>
234234 this . _offset = val ;
235235 }
236236 get offset ( ) : number {
237- return Math . max ( Math . min ( this . _offset , Math . ceil ( this . rowCount / this . pageSize ) - 1 ) , 0 ) ;
237+ return Math . max ( Math . min ( this . _offset , Math . ceil ( this . rowCount ( ) / this . pageSize ) - 1 ) , 0 ) ;
238238 }
239239
240240 /**
@@ -667,7 +667,7 @@ export class DatatableComponent<TRow extends Row = any>
667667 }
668668 return 0 ;
669669 } ) ;
670- rowCount = 0 ;
670+ readonly rowCount = computed ( ( ) => this . calcRowCount ( ) ) ;
671671 rowDiffer : IterableDiffer < TRow | undefined > = inject ( IterableDiffers ) . find ( [ ] ) . create ( ) ;
672672 /** This counter is increased, when the rowDiffer detects a change. This will cause an update of _internalRows. */
673673 private readonly _rowDiffCount = signal ( 0 ) ;
@@ -766,12 +766,6 @@ export class DatatableComponent<TRow extends Row = any>
766766 // Recalculate without tracking other signals
767767 untracked ( ( ) => this . recalculateDims ( ) ) ;
768768 } ) ;
769- // Recalculates the rowCount when internal rows change
770- // TODO: This should be a computed signal.
771- effect ( ( ) => {
772- this . _internalRows ( ) ;
773- this . rowCount = untracked ( ( ) => this . calcRowCount ( ) ) ;
774- } ) ;
775769 }
776770
777771 /**
@@ -961,7 +955,6 @@ export class DatatableComponent<TRow extends Row = any>
961955 */
962956 recalculatePages ( ) : void {
963957 this . pageSize = this . calcPageSize ( ) ;
964- this . rowCount = this . calcRowCount ( ) ;
965958 }
966959
967960 /**
You can’t perform that action at this time.
0 commit comments