Dynamic itemsPerPage on assets list.

This commit is contained in:
softsimon 2020-06-01 15:56:32 +07:00
parent 3cf839e1da
commit e917d40909
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -20,7 +20,9 @@ export class AssetsComponent implements OnInit {
error: any;
page = 1;
itemsPerPage = 15;
itemsPerPage: number;
contentSpace = window.innerHeight - (250 + 200);
fiveItemsPxSize = 250;
constructor(
private assetsService: AssetsService,
@ -28,6 +30,11 @@ export class AssetsComponent implements OnInit {
) { }
ngOnInit() {
this.itemsPerPage = Math.round(this.contentSpace / this.fiveItemsPxSize) * 5;
if (this.itemsPerPage === 5) {
this.itemsPerPage = 10;
}
setTimeout(() => this.getAssets());
this.searchForm = this.formBuilder.group({