I already been in angular material project with expandable rows and succeed in making those, by referring here. But i got a bit of a problem since the example I'm following only got one column in for the expanded row. So my question is can I make the expandable row have the exact column as the parent row? And if it possible, can I have some example/guide?
Thanks in advance.
I already tried making a table in the expanded row, but the issue is the table are a bit troublesome to align with the parent column. I would like if I could use mat-table just as the same as the parent column just without the [datasource] since the data I'm trying to display is already in the expanded row.
<!-- Expanded Column - The detail row is made up of this one column -->
<ng-container matColumnDef="expandedDetail">
<mat-cell *matCellDef="let detail"> -- Im want to use data in 'detail'
-- table in here that has the same column as the parent table --
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"
matRipple
class="element-row"
[class.expanded]="expandedElement == row"
(click)="expandedElement = row"></mat-row>
<mat-row *matRowDef="let row; columns: ['expandedDetail']; when: isExpansionDetailRow"
[@detailExpand]="row.element == expandedElement ? 'expanded' : 'collapsed'"
style="overflow: hidden">
</mat-row>
Say the table got 5 parent column, so I would expect the expanded row would have 5 column as well which follow the parent column width.