Fix sur la pagination et fix sur le tri par date
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
position: relative;
|
||||
height: 600px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div *ngIf="dataSourceTable != null else loading">
|
||||
<div *ngIf="dataSourceTable != null else loading" class="table-container">
|
||||
<table mat-table [dataSource]="dataSourceTable">
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef>ID</th>
|
||||
@@ -30,6 +30,6 @@
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
<mat-paginator [length]="resultsLength" [pageSize]="10"></mat-paginator>
|
||||
</div>
|
||||
<mat-paginator [length]="resultsLength" [pageSize]="10"></mat-paginator>
|
||||
<ng-template #loading>Waiting...</ng-template>
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { MatPaginator } from "@angular/material/paginator";
|
||||
import { MatTableDataSource } from "@angular/material/table";
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
||||
import { Observable } from "rxjs";
|
||||
import { JumpResp } from "../../models/jump";
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { Observable } from 'rxjs';
|
||||
import { JumpResp } from '../../models/jump';
|
||||
import { ServiceApiGet } from '../../services/service-api-get.service';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
|
||||
@Component({
|
||||
selector: "app-list-of-jumps",
|
||||
templateUrl: "./list-of-jumps.component.html",
|
||||
styleUrls: ["./list-of-jumps.component.css"]
|
||||
selector: 'app-list-of-jumps',
|
||||
templateUrl: './list-of-jumps.component.html',
|
||||
styleUrls: ['./list-of-jumps.component.css']
|
||||
})
|
||||
export class ListOfJumpsComponent implements OnInit {
|
||||
public listOfJumps: Observable<Array<JumpResp>>;
|
||||
public displayedColumns: Array<string> = [
|
||||
"id",
|
||||
"jumpDate",
|
||||
"jumpType",
|
||||
"aircraft",
|
||||
"dropZone",
|
||||
"gear"
|
||||
'id',
|
||||
'jumpDate',
|
||||
'jumpType',
|
||||
'aircraft',
|
||||
'dropZone',
|
||||
'gear'
|
||||
];
|
||||
public dataSourceTable;
|
||||
public resultsLength = 0;
|
||||
@@ -29,16 +29,17 @@ export class ListOfJumpsComponent implements OnInit {
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle("List of jumps");
|
||||
this.serviceComm.updatedComponentTitle('List of jumps');
|
||||
this.getListOfJumps();
|
||||
}
|
||||
|
||||
getListOfJumps() {
|
||||
this.listOfJumps = this.serviceApi.getListOfJumps();
|
||||
this.listOfJumps.subscribe(data => {
|
||||
data.sort((a, b) => b.jumpDate.getTime() - a.jumpDate.getTime());
|
||||
this.dataSourceTable = new MatTableDataSource<JumpResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.resultsLength = data.length;
|
||||
|
||||
Reference in New Issue
Block a user