fixing problems with infinite scroll due to hidden scrollbar and filtering

This commit is contained in:
Michael Hoennig 2019-05-03 23:17:52 +02:00
parent d672d5b0cd
commit fbb356c8e9
6 changed files with 8 additions and 15 deletions

View File

@ -62,7 +62,7 @@ export class AssetComponent implements OnInit, OnDestroy {
}, },
500, 500,
() => { () => {
this.loadAll(); this.reset();
} }
); );
} }
@ -130,8 +130,6 @@ export class AssetComponent implements OnInit, OnDestroy {
protected paginateAssets(data: IAsset[], headers: HttpHeaders) { protected paginateAssets(data: IAsset[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link')); this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10); this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
this.page = 0;
this.assets = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
this.assets.push(data[i]); this.assets.push(data[i]);
} }

View File

@ -50,7 +50,7 @@ export class CustomerComponent implements OnInit, OnDestroy {
}, },
500, 500,
() => { () => {
this.loadAll(); this.reset();
} }
); );
} }
@ -111,8 +111,6 @@ export class CustomerComponent implements OnInit, OnDestroy {
protected paginateCustomers(data: ICustomer[], headers: HttpHeaders) { protected paginateCustomers(data: ICustomer[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link')); this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10); this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
this.page = 0;
this.customers = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
this.customers.push(data[i]); this.customers.push(data[i]);
} }

View File

@ -62,7 +62,7 @@ export class MembershipComponent implements OnInit, OnDestroy {
}, },
500, 500,
() => { () => {
this.loadAll(); this.reset();
} }
); );
} }
@ -130,7 +130,6 @@ export class MembershipComponent implements OnInit, OnDestroy {
protected paginateMemberships(data: IMembership[], headers: HttpHeaders) { protected paginateMemberships(data: IMembership[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link')); this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10); this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
this.page = 0;
this.memberships = []; this.memberships = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
this.memberships.push(data[i]); this.memberships.push(data[i]);

View File

@ -71,7 +71,7 @@ export class SepaMandateComponent implements OnInit, OnDestroy {
}, },
500, 500,
() => { () => {
this.loadAll(); this.reset();
} }
); );
} }
@ -139,8 +139,6 @@ export class SepaMandateComponent implements OnInit, OnDestroy {
protected paginateSepaMandates(data: ISepaMandate[], headers: HttpHeaders) { protected paginateSepaMandates(data: ISepaMandate[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link')); this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10); this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
this.page = 0;
this.sepaMandates = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
this.sepaMandates.push(data[i]); this.sepaMandates.push(data[i]);
} }

View File

@ -62,7 +62,7 @@ export class ShareComponent implements OnInit, OnDestroy {
}, },
500, 500,
() => { () => {
this.loadAll(); this.reset();
} }
); );
} }
@ -130,8 +130,6 @@ export class ShareComponent implements OnInit, OnDestroy {
protected paginateShares(data: IShare[], headers: HttpHeaders) { protected paginateShares(data: IShare[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link')); this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10); this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
this.page = 0;
this.shares = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
this.shares.push(data[i]); this.shares.push(data[i]);
} }

View File

@ -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;