I can sort multiple columns while using a p-table
with PrimeNG as following :
[multiSortMeta]="[{field: 'quantity', order: -1}, {field: 'price', order: 1}]"
<h3>Multi Sort Columns</h3>
<p-table
[columns]="cols"
[value]="cars1"
[lazy]="lazy"
[lazyLoadOnInit]="lazyLoadOnInit"
(onLazyLoad)="loadList($event)"
[sortMode]="sortMode"
[multiSortMeta]="[{field: 'quantity', order: -1}, {field: 'price', order: 1}]">
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field">
{{col.header}}
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr>
<td *ngFor="let col of columns">
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
</p-table>
Yet, having two columns highlighted by default can be confusing. How can I have a default sort for two columns, yet only highlight the primary column?