@@ -121,7 +121,7 @@ import { DataTableSummaryRowComponent } from './summary/summary-row.component';
121121 "
122122 [innerWidth]="innerWidth()"
123123 [rowDetail]="rowDetail()"
124- [detailRowHeight ]="getDetailRowHeight(row, index )"
124+ [detailRowHeightFn ]="detailRowHeightFn( )"
125125 [row]="row"
126126 [disabled]="disabled"
127127 [expanded]="getRowExpanded(row)"
@@ -340,6 +340,15 @@ export class DataTableBodyComponent<TRow extends Row = any> implements OnInit, O
340340 return undefined ;
341341 } ) ;
342342
343+ readonly detailRowHeightFn = computed ( ( ) => {
344+ const rowDetail = this . rowDetail ( ) ;
345+ if ( ! rowDetail ) {
346+ return ( ) => 0 ;
347+ }
348+ const rowHeight = rowDetail . rowHeight ( ) ;
349+ return typeof rowHeight === 'function' ? rowHeight : ( ) => rowHeight ;
350+ } ) ;
351+
343352 readonly rowsToRender = computed ( ( ) => {
344353 return this . updateRows ( ) ;
345354 } ) ;
@@ -566,18 +575,6 @@ export class DataTableBodyComponent<TRow extends Row = any> implements OnInit, O
566575 return rowHeight as number ;
567576 }
568577
569- /**
570- * Get the height of the detail row.
571- */
572- getDetailRowHeight = ( row ?: TRow , index ?: number ) : number => {
573- const rowDetail = this . rowDetail ( ) ;
574- if ( ! rowDetail ) {
575- return 0 ;
576- }
577- const rowHeight = rowDetail . rowHeight ( ) ;
578- return typeof rowHeight === 'function' ? rowHeight ( row , index ) : ( rowHeight as number ) ;
579- } ;
580-
581578 getGroupHeaderRowHeight = ( row ?: any , index ?: any ) : number => {
582579 const groupHeader = this . groupHeader ( ) ;
583580 if ( ! groupHeader ) {
@@ -645,7 +642,7 @@ export class DataTableBodyComponent<TRow extends Row = any> implements OnInit, O
645642 cache . initCache ( {
646643 rows : this . rows ( ) as TRow [ ] , // TODO: RowHeightCache does not support grouping
647644 rowHeight : this . rowHeight ( ) ,
648- detailRowHeight : this . getDetailRowHeight ,
645+ detailRowHeight : this . detailRowHeightFn ( ) ,
649646 externalVirtual : this . scrollbarV ( ) && this . externalPaging ( ) ,
650647 indexOffset : this . externalPaging ( ) ? this . offset ( ) * this . pageSize ( ) : 0 ,
651648 rowCount : this . rowCount ( ) ,
0 commit comments