From fbb356c8e906901ab35030d88361a90e822db300 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 3 May 2019 23:17:52 +0200 Subject: [PATCH] fixing problems with infinite scroll due to hidden scrollbar and filtering --- src/main/webapp/app/entities/asset/asset.component.ts | 4 +--- src/main/webapp/app/entities/customer/customer.component.ts | 4 +--- .../webapp/app/entities/membership/membership.component.ts | 3 +-- .../app/entities/sepa-mandate/sepa-mandate.component.ts | 4 +--- src/main/webapp/app/entities/share/share.component.ts | 4 +--- src/main/webapp/app/shared/constants/pagination.constants.ts | 4 +++- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main/webapp/app/entities/asset/asset.component.ts b/src/main/webapp/app/entities/asset/asset.component.ts index 93adb998..19220504 100644 --- a/src/main/webapp/app/entities/asset/asset.component.ts +++ b/src/main/webapp/app/entities/asset/asset.component.ts @@ -62,7 +62,7 @@ export class AssetComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -130,8 +130,6 @@ export class AssetComponent implements OnInit, OnDestroy { protected paginateAssets(data: IAsset[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; - this.assets = []; for (let i = 0; i < data.length; i++) { this.assets.push(data[i]); } diff --git a/src/main/webapp/app/entities/customer/customer.component.ts b/src/main/webapp/app/entities/customer/customer.component.ts index 7b66eb1d..94aa2e18 100644 --- a/src/main/webapp/app/entities/customer/customer.component.ts +++ b/src/main/webapp/app/entities/customer/customer.component.ts @@ -50,7 +50,7 @@ export class CustomerComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -111,8 +111,6 @@ export class CustomerComponent implements OnInit, OnDestroy { protected paginateCustomers(data: ICustomer[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; - this.customers = []; for (let i = 0; i < data.length; i++) { this.customers.push(data[i]); } diff --git a/src/main/webapp/app/entities/membership/membership.component.ts b/src/main/webapp/app/entities/membership/membership.component.ts index 6f015b30..5ca7c86a 100644 --- a/src/main/webapp/app/entities/membership/membership.component.ts +++ b/src/main/webapp/app/entities/membership/membership.component.ts @@ -62,7 +62,7 @@ export class MembershipComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -130,7 +130,6 @@ export class MembershipComponent implements OnInit, OnDestroy { protected paginateMemberships(data: IMembership[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; this.memberships = []; for (let i = 0; i < data.length; i++) { this.memberships.push(data[i]); diff --git a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts index 1ca9e056..d78686dd 100644 --- a/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts +++ b/src/main/webapp/app/entities/sepa-mandate/sepa-mandate.component.ts @@ -71,7 +71,7 @@ export class SepaMandateComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -139,8 +139,6 @@ export class SepaMandateComponent implements OnInit, OnDestroy { protected paginateSepaMandates(data: ISepaMandate[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; - this.sepaMandates = []; for (let i = 0; i < data.length; i++) { this.sepaMandates.push(data[i]); } diff --git a/src/main/webapp/app/entities/share/share.component.ts b/src/main/webapp/app/entities/share/share.component.ts index 0cc45003..831b30c6 100644 --- a/src/main/webapp/app/entities/share/share.component.ts +++ b/src/main/webapp/app/entities/share/share.component.ts @@ -62,7 +62,7 @@ export class ShareComponent implements OnInit, OnDestroy { }, 500, () => { - this.loadAll(); + this.reset(); } ); } @@ -130,8 +130,6 @@ export class ShareComponent implements OnInit, OnDestroy { protected paginateShares(data: IShare[], headers: HttpHeaders) { this.links = this.parseLinks.parse(headers.get('link')); this.totalItems = parseInt(headers.get('X-Total-Count'), 10); - this.page = 0; - this.shares = []; for (let i = 0; i < data.length; i++) { this.shares.push(data[i]); } diff --git a/src/main/webapp/app/shared/constants/pagination.constants.ts b/src/main/webapp/app/shared/constants/pagination.constants.ts index a148d457..1d1b27bb 100644 --- a/src/main/webapp/app/shared/constants/pagination.constants.ts +++ b/src/main/webapp/app/shared/constants/pagination.constants.ts @@ -1 +1,3 @@ -export const ITEMS_PER_PAGE = 20; +// For infinite scroll, it should be more than fits into a window height. +// Otherwise, the scrollbar might not be there at all, and further pages can't be reached. +export const ITEMS_PER_PAGE = 100;