I'm working on a compare view with expansion panels of Angular Material.
It's dynamically rendered depending on how many dogs/parts I'm comparing, setting columns in a mat-grid-list who contains parts that can be compared, as expansion panels.
<h2 class="dogs-comparison--header">dogs Comparison</h2>
<mat-grid-list [cols]="dogs.length" rowHeight="20:1" *ngIf="!isLoading">
<mat-grid-tile *ngFor="let dog of dogs" colspan="1" rowspan="2" layout="layout-fill">
<mat-grid-tile-header class="column-header">
{{dog['title']}}
</mat-grid-tile-header>
<mat-accordion multi="true" class="dog-compare--dog_parts">
<mat-expansion-panel *ngFor="let part of dog['parts']" [expanded]="part.isExpanded">
<mat-expansion-panel-header>
<mat-panel-title>
{{ part.partTitle}}
</mat-panel-title>
</mat-expansion-panel-header>
<p *ngFor="let item of part['items']">
{{item.itemTitle}}: <span>{{item.itemValue}}</span>
</p>
</mat-expansion-panel>
</mat-accordion>
</mat-grid-tile>
</mat-grid-list>
My question is : is there any way that I could, when clicking one of the parts as expansion panel in one column, open the adjacent column's expansion panels. So let's say Dog has a part called Anatomy, I compare Dog1, Dog2 and Dog3, If I toggle Dog1 Anatomy expansion panel, the two others would toggle as well ?
I'm struggling a bit, checking on how I can have dynamic/similar IDs but I'm stuck on the question for now.
Thank you for the help