"Sort" sur les tableaux et listes déroulantes.
This commit is contained in:
@@ -18,7 +18,6 @@ import { NewDropZoneComponent } from '../new-drop-zone/new-drop-zone.component';
|
||||
export class ListOfDzsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = [
|
||||
'isfavorite',
|
||||
'id',
|
||||
'name',
|
||||
'address',
|
||||
'type',
|
||||
@@ -49,7 +48,7 @@ export class ListOfDzsComponent implements OnInit {
|
||||
private getListOfDropZones() {
|
||||
this.serviceApi.getListOfDropZones().subscribe((data) => {
|
||||
setTimeout(() => {
|
||||
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
|
||||
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0) || a.name.localeCompare(b.name));
|
||||
this.dataSourceTable = new MatTableDataSource<DropZoneResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.resultsLength = data.length;
|
||||
|
||||
Reference in New Issue
Block a user