"Sort" sur les tableaux et listes déroulantes.
This commit is contained in:
@@ -16,7 +16,6 @@ import { NewGearComponent } from "../new-gear/new-gear.component";
|
||||
})
|
||||
export class ListOfGearsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = [
|
||||
"id",
|
||||
"name",
|
||||
"manufacturer",
|
||||
"maxSize",
|
||||
@@ -47,6 +46,7 @@ export class ListOfGearsComponent implements OnInit {
|
||||
this.serviceApi.getListOfGears()
|
||||
.subscribe(data => {
|
||||
setTimeout(() => {
|
||||
data.sort((a, b) => b.id - a.id);
|
||||
this.dataSourceTable = new MatTableDataSource<GearResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.resultsLength = data.length;
|
||||
|
||||
Reference in New Issue
Block a user