I recently came across a great stackblitz example showcasing nested material tables and I wanted to implement something similar in my project. You can check it out here: https://stackblitz.com/edit/angular-nested-mat-table?file=app%2Ftable-expandable-rows-example.ts
This method involves creating a "hidden" row, where if you inspect the page, you’ll notice rows with the class "example-element-row" followed by one with the class "example-detail-row". The "example-detail-row" is the hidden row.
However, I encountered an issue with my corporate CSS table class that adds extra padding and a striped-like view (with every even row having a gray background). This makes the hidden row still visible and disrupts the overall look of my table. Here’s how it currently looks: https://i.sstatic.net/dV227.png
I’ve tried adding an *ngIf directive with a flag in the code snippet below to hide the row, but this ended up breaking the expandable rows feature. Despite this, the table renders perfectly without the hidden row being displayed:
<tr *ngIf="flag" mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr>