-
Notifications
You must be signed in to change notification settings - Fork 6.8k
/
Copy pathtable-sorting-example.html
52 lines (45 loc) · 1.9 KB
/
table-sorting-example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<mat-button-toggle-group [(ngModel)]="multiSortEnabled">
<mat-button-toggle [value]="false">Single-sorting</mat-button-toggle>
<mat-button-toggle [value]="true">Multi-sorting</mat-button-toggle>
</mat-button-toggle-group>
<table mat-table [dataSource]="dataSource" matSort (matSortChange)="announceSortChange($event)"
[matSortMultiple]="multiSortEnabled"
class="mat-elevation-z8">
<!-- First name Column -->
<ng-container matColumnDef="firstName">
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by first name">
First name
</th>
<td mat-cell *matCellDef="let element"> {{element.firstName}} </td>
</ng-container>
<!-- Last name Column -->
<ng-container matColumnDef="lastName">
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by last name">
Last name
</th>
<td mat-cell *matCellDef="let element"> {{element.lastName}} </td>
</ng-container>
<!-- Position Column -->
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by position">
Position
</th>
<td mat-cell *matCellDef="let element"> {{element.position}} </td>
</ng-container>
<!-- Office Column -->
<ng-container matColumnDef="office">
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by office">
Office
</th>
<td mat-cell *matCellDef="let element"> {{element.office}} </td>
</ng-container>
<!-- Salary Column -->
<ng-container matColumnDef="salary">
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription="Sort by salary">
Salary
</th>
<td mat-cell *matCellDef="let element"> {{element.salary}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>