I use Angular material to make a table whose columns contain multi property value from [dataSource]. I want to make sort for each property in columns. When click to an arrow correspond to a property in a column, the table will be sorted immediately follow this property. But it's currently impossible with me. I researched about MatSort but it seem not support for my case.
The table look like:
You can see, in the first column: there are 2 property shown: 'Rental' and 'Management fee'. When I click to the sorting arrow in the left side of 'Rental', the table will sort follow 'Rental'. When I click in 'Management fee', the table will sort follow 'Management fee', the same for another columns.
For one column: I made a look like this:
<ng-container matColumnDef="fee">
<th *matHeaderCellDef mat-header-cell>
<div class="table-row-name">
<mat-icon class="btn-up">keyboard_arrow_up</mat-icon>
<span i18n="@@Rental">Rental</span>
</div>
<div class="table-row-name">
<mat-icon class="btn-up">keyboard_arrow_up</mat-icon>
<span i18n="@@Fee">Management fee</span>
</div>
</th>
<td *matCellDef="let element" mat-cell>
<p>
<span>{{ element.rent }}</span>
<span> Euro</span>
</p>
<p>
<span>{{ element.managementFee }}</span>
<span> USD</span>
</p>
</td>
</ng-container>
I use Angular version 7.0
Can anybody help me in this case. Thank you so much.