Imagine I have a MatTableDataSource that is created using the following array:
[ {propA: 'something', propB: ['a', 'b', 'c']}, {propA: 'somethingElse', propB: ['d', 'e', 'f']}]
This array consists of objects where propB is an array.
Now, for each element in the outer array, I would like to display a row in my table with two columns: propA (displaying the value of this property) and propBCount (showing the length of the array for this property).
Below is the column definition for the second column I desire:
<ng-container matColumnDef="propBCount">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Total Items </th>
<td mat-cell *matCellDef="let element"> {{element.propB.length}} </td>
</ng-container>
How can I implement mat-sort-header for this particular column?