Revised pageSize input to override the value provided via configuration.

This commit is contained in:
Michael Spalti
2022-09-20 17:08:57 -07:00
parent 1ebaa65161
commit 4d43a34cb3
2 changed files with 10 additions and 4 deletions

View File

@@ -12,6 +12,7 @@ import { SortDirection, SortOptions } from '../../core/cache/models/sort-options
import { CollectionDataService } from '../../core/data/collection-data.service';
import { PaginationService } from '../../core/pagination/pagination.service';
import { switchMap } from 'rxjs/operators';
import { hasValue } from '../../shared/empty.util';
@Component({
selector: 'ds-community-page-sub-collection-list',
@@ -23,7 +24,7 @@ export class CommunityPageSubCollectionListComponent implements OnInit, OnDestro
@Input() community: Community;
/**
* Optional page size (defaults to 5)
* Optional page size. Overrides communityList.pageSize configuration for this component.
*/
@Input() pageSize: number;
@@ -55,7 +56,9 @@ export class CommunityPageSubCollectionListComponent implements OnInit, OnDestro
ngOnInit(): void {
this.config = new PaginationComponentOptions();
this.config.id = this.pageId;
this.pageSize ? this.config.pageSize = this.pageSize : this.config.pageSize = 5;
if(hasValue(this.pageSize)) {
this.config.pageSize = this.pageSize
}
this.config.currentPage = 1;
this.sortConfig = new SortOptions('dc.title', SortDirection.ASC);
this.initPage();

View File

@@ -12,6 +12,7 @@ import { CommunityDataService } from '../../core/data/community-data.service';
import { takeUntilCompletedRemoteData } from '../../core/shared/operators';
import { switchMap } from 'rxjs/operators';
import { PaginationService } from '../../core/pagination/pagination.service';
import { hasValue } from '../../shared/empty.util';
@Component({
selector: 'ds-community-page-sub-community-list',
@@ -26,7 +27,7 @@ export class CommunityPageSubCommunityListComponent implements OnInit, OnDestroy
@Input() community: Community;
/**
* Optional page size (defaults to 5).
* Optional page size. Overrides communityList.pageSize configuration for this component.
*/
@Input() pageSize: number;
@@ -58,7 +59,9 @@ export class CommunityPageSubCommunityListComponent implements OnInit, OnDestroy
ngOnInit(): void {
this.config = new PaginationComponentOptions();
this.config.id = this.pageId;
this.pageSize ? this.config.pageSize = this.pageSize : this.config.pageSize = 5;
if(hasValue(this.pageSize)) {
this.config.pageSize = this.pageSize
}
this.config.currentPage = 1;
this.sortConfig = new SortOptions('dc.title', SortDirection.ASC);
this.initPage();