From e917d4090916056d0e3f79e1bca8e668c827e417 Mon Sep 17 00:00:00 2001 From: softsimon Date: Mon, 1 Jun 2020 15:56:32 +0700 Subject: [PATCH] Dynamic itemsPerPage on assets list. --- frontend/src/app/assets/assets.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/assets/assets.component.ts b/frontend/src/app/assets/assets.component.ts index 48433c370..cbe6781d7 100644 --- a/frontend/src/app/assets/assets.component.ts +++ b/frontend/src/app/assets/assets.component.ts @@ -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({