Feature Request
To be able to make a second footer/header in which I can use the same columns but different data for the cells then the other footer/header
Currently you can have multiple mat-footer-rows on a table but it has to have matColumnDefs for each one. IE let's say I have a second footer row that I want to go into the same columns that are setup but with different data. The only way I can see to do this is to make a new array of columns, send that into that footerDef and make the matColumnDefs for those.
https://stackblitz.com/edit/angular-tcdbaj
The use case is to have multiple footers or headers that have different data, about that column
Angular 6.0.9, Newest Material, etc
We also need that, why there is no reaction ?
And why everything is always half baked.
There comes footers but no ability to pass data.
Why this is not working: (like with normal rows)
<ng-container *ngFor="let footerRow of footerRows">
<tr mat-footer-row *matFooterRowDef="let footerRow; columns:getDisplayedFooterColumns()"></tr>
</ng-container>
<td mat-footer-cell *matFooterCellDef="let element">
{{element[i]}} <!-- have acces to the passed data -->
</td>
I need that
I need that too!
I have the same problem
Has anyone found a workaround?
Facing the same issue
Also having this issue
I need this to add multiple footer with having different number of columns
One ugly, but working solution I found, is to define multiple cells dynamically as shown in the Example below:
<ng-container *ngFor="let footerEntry of footerData; let footerEntryIndex = index">
<ng-container matColumnDef="column1-{{footerEntryIndex}}">
<mat-footer-cell *matFooterCellDef>
<span>{{ footerEntry.footerEntryProp}}</span>
</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="column2-{{footerEntryIndex}}">
<mat-footer-cell *matFooterCellDef>
<span> {{ footerEntry.footerEntryProp2}}</span>
</mat-footer-cell>
</ng-container>
</ng-container>
You can then render all of your footer data as shown in this snippet:
<ng-container *ngFor="let footerEntry of footerData; let footerEntryIndex = index">
<mat-footer-row *matFooterRowDef="['column1-'+footerEntryIndex, 'column2-'+footerEntryIndex]; sticky: true" ></mat-footer-row>
</ng-container>
hope that someone can use this workaround.
Most helpful comment
We also need that, why there is no reaction ?
And why everything is always half baked.
There comes footers but no ability to pass data.
Why this is not working: (like with normal rows)
<ng-container *ngFor="let footerRow of footerRows"> <tr mat-footer-row *matFooterRowDef="let footerRow; columns:getDisplayedFooterColumns()"></tr> </ng-container><td mat-footer-cell *matFooterCellDef="let element"> {{element[i]}} <!-- have acces to the passed data --> </td>