Fix sur la pagination et fix sur le tri par date
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { MatPaginator, MatTableDataSource } from "@angular/material";
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator, MatTableDataSource } from '@angular/material';
|
||||
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { GearResp } from "../../models/gear";
|
||||
import { ServiceApiGet } from '../../services/service-api-get.service';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { GearResp } from '../../models/gear';
|
||||
|
||||
@Component({
|
||||
selector: "app-list-of-gears",
|
||||
templateUrl: "./list-of-gears.component.html",
|
||||
styleUrls: ["./list-of-gears.component.css"]
|
||||
selector: 'app-list-of-gears',
|
||||
templateUrl: './list-of-gears.component.html',
|
||||
styleUrls: ['./list-of-gears.component.css']
|
||||
})
|
||||
export class ListOfGearsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = [
|
||||
"id",
|
||||
"name",
|
||||
"latitude",
|
||||
"longitude",
|
||||
"address",
|
||||
"email",
|
||||
"type"
|
||||
'id',
|
||||
'name',
|
||||
'latitude',
|
||||
'longitude',
|
||||
'address',
|
||||
'email',
|
||||
'type'
|
||||
];
|
||||
public dataSourceTable;
|
||||
public resultsLength = 0;
|
||||
@@ -27,15 +27,16 @@ export class ListOfGearsComponent implements OnInit {
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle("List of gears");
|
||||
this.serviceComm.updatedComponentTitle('List of gears');
|
||||
this.getListOfGears();
|
||||
}
|
||||
|
||||
getListOfGears() {
|
||||
this.serviceApi.getListOfGears().subscribe(data => {
|
||||
//data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
|
||||
this.dataSourceTable = new MatTableDataSource<GearResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.resultsLength = data.length;
|
||||
|
||||
Reference in New Issue
Block a user