Sort players by id
This commit is contained in:
@@ -34,7 +34,7 @@ export class PlayerListComponent implements AfterViewInit {
|
||||
|
||||
players: Player[];
|
||||
|
||||
displayedColumns: string[] = ['position', 'name', 'sex', 'club', 'action'];
|
||||
displayedColumns: string[] = ['id', 'name', 'sex', 'club', 'action'];
|
||||
dataSource: MatTableDataSource<Player>
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
@@ -53,9 +53,9 @@ export class PlayerListComponent implements AfterViewInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sortingDataAccessor = (item, header) => {
|
||||
switch (header) {
|
||||
case 'id': return item.id;
|
||||
case 'club': return item.club;
|
||||
default: return item.lastName + item.firstName;
|
||||
// case 'name': return this.fullNamePipe.transform(item);
|
||||
}
|
||||
}
|
||||
this.dataSource.sort = this.sort;
|
||||
|
||||
Reference in New Issue
Block a user