Hi Ahmad,
Thanks for sharing the details.
Based on the provided information, we could understand that you need to render detailTemplate based on condition. Before proceeding with your requirement we would like to explain the detailTemplate feature of Grid for your reference below,
The detail template provides additional information about a particular row by expanding or collapsing detail content. The detailTemplate property accepts either the template or HTML element ID. Since this is its default behaviour.
In your sample you have not defined the proper HTML element to the detailTemplate property which is the cause of the issue. So, To overcome the reported issue, We suggest you to define the proper detailTemplate property(Since the detailTemplate will be rendered based on the element Id ) as demonstrated in the below code snippet,
<ng-container *ngIf="dataSource$ | async as dataView">
<ejs-grid #grid [height]="500" [dataSource]="dataView" [columns]="dataView.columns">
<ng-template *ngIf="hierarchical" #detailTemplate let-row>
<app-child-table [parentRow]="row" [columns]="dataView.columns" [allRows]="dataView.allRows">
</app-child-table>
</ng-template>
</ejs-grid>
</ng-container> |
Also, we found in your sample you have enabled the ‘hierarchical’ flag variable inside the setTimeOut function(which means you have tried to define a property after the Grid is rendered). This will not render the detailTemplate feature in the Grid. So we suggest you to define the property while Grid initializes.
More details on detailTemplate feature can be checked in the below documentation link,