Changement sur l'affichage de la pagination
This commit is contained in:
@@ -25,4 +25,4 @@
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
<mat-paginator [pageSize]="10" [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons></mat-paginator>
|
||||
<mat-paginator [length]="resultsLength" [pageSize]="10"></mat-paginator>
|
||||
|
||||
@@ -1,36 +1,37 @@
|
||||
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",
|
||||
"jumpTypeId",
|
||||
"aircraftId",
|
||||
"dropZoneId"
|
||||
'id',
|
||||
'jumpDate',
|
||||
'jumpTypeId',
|
||||
'aircraftId',
|
||||
'dropZoneId'
|
||||
];
|
||||
public dataSourceTable;
|
||||
public resultsLength = 0;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle("List of jumps");
|
||||
this.serviceComm.updatedComponentTitle('List of jumps');
|
||||
this.getListOfJumps();
|
||||
}
|
||||
|
||||
@@ -39,6 +40,7 @@ export class ListOfJumpsComponent implements OnInit {
|
||||
this.listOfJumps.subscribe(data => {
|
||||
this.dataSourceTable = new MatTableDataSource<JumpResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.resultsLength = data.length;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user