diff --git a/src/app/home/top-level-community-list/top-level-community-list.component.html b/src/app/home/top-level-community-list/top-level-community-list.component.html
index 7cd24f8fcf..9acaf54dd9 100644
--- a/src/app/home/top-level-community-list/top-level-community-list.component.html
+++ b/src/app/home/top-level-community-list/top-level-community-list.component.html
@@ -1,13 +1,7 @@
{{'home.top-level-communities.head' | translate}}
{{'home.top-level-communities.help' | translate}}
-
-
-
-
-
-
-
-
-
+
diff --git a/src/app/home/top-level-community-list/top-level-community-list.component.ts b/src/app/home/top-level-community-list/top-level-community-list.component.ts
index cedca3d148..80a4fd967a 100644
--- a/src/app/home/top-level-community-list/top-level-community-list.component.ts
+++ b/src/app/home/top-level-community-list/top-level-community-list.component.ts
@@ -2,7 +2,8 @@ import { Component, OnInit } from '@angular/core';
import { RemoteData } from "../../core/data/remote-data";
import { ItemDataService } from "../../core/data/item-data.service";
import { Item } from "../../core/shared/item.model";
-import { PaginationOptions } from "../../core/cache/models/pagination-options.model";
+import { PaginationComponentOptions } from "../../shared/pagination/pagination-component-options.model";
+import { SortOptions } from "../../core/cache/models/sort-options.model";
@Component({
selector: 'ds-top-level-community-list',
@@ -11,7 +12,7 @@ import { PaginationOptions } from "../../core/cache/models/pagination-options.mo
})
export class TopLevelCommunityListComponent implements OnInit {
topLevelCommunities: RemoteData- ;
- config : PaginationOptions;
+ config : PaginationComponentOptions;
constructor(
private cds: ItemDataService
@@ -25,8 +26,22 @@ export class TopLevelCommunityListComponent implements OnInit {
ngOnInit(): void {
this.topLevelCommunities = this.cds.findAll();
- this.config = new PaginationOptions();
+ this.config = new PaginationComponentOptions();
this.config.id = "top-level-pagination"
this.config.pageSizeOptions = [ 5, 10, 20, 40, 60, 80, 100 ];
}
+
+ onPageChange(currentPage): void {
+ this.config.currentPage = currentPage;
+ this.updateResults();
+ }
+
+ onPageSizeChange(elementsPerPage): void {
+ this.config.pageSize = elementsPerPage;
+ this.updateResults();
+ }
+
+ updateResults() {
+ this.topLevelCommunities = this.cds.findAll({ currentPage: this.config.currentPage, elementsPerPage: this.config.pageSize });
+ }
}
diff --git a/src/app/object-list/object-list.component.html b/src/app/object-list/object-list.component.html
index d1b0ce4578..fa2621d2d9 100644
--- a/src/app/object-list/object-list.component.html
+++ b/src/app/object-list/object-list.component.html
@@ -1,7 +1,7 @@
+ (pageChange)="onPageChange($event)"
+ (pageSizeChange)="onPageSizeChange($event)">
-
diff --git a/src/app/object-list/object-list.component.ts b/src/app/object-list/object-list.component.ts
index 0454022554..545b106551 100644
--- a/src/app/object-list/object-list.component.ts
+++ b/src/app/object-list/object-list.component.ts
@@ -1,12 +1,13 @@
import {
Component, Input, ViewEncapsulation, ChangeDetectionStrategy,
- OnInit
+ OnInit, Output
} from '@angular/core';
import { RemoteData } from "../core/data/remote-data";
import { DSpaceObject } from "../core/shared/dspace-object.model";
-import { PaginationOptions } from "../core/cache/models/pagination-options.model";
import { PageInfo } from "../core/shared/page-info.model";
import { Observable } from "rxjs";
+import { PaginationComponentOptions } from "../shared/pagination/pagination-component-options.model";
+import { EventEmitter } from "@angular/common/src/facade/async";
@Component({
@@ -19,8 +20,11 @@ import { Observable } from "rxjs";
export class ObjectListComponent implements OnInit {
@Input() objects: RemoteData;
- @Input() config : PaginationOptions;
+ @Input() config : PaginationComponentOptions;
pageInfo : Observable;
+
+ @Output() pageChange = new EventEmitter();
+ @Output() pageSizeChange = new EventEmitter();
data: any = {};
constructor() {
@@ -34,4 +38,11 @@ export class ObjectListComponent implements OnInit {
this.pageInfo = this.objects.pageInfo;
}
+ onPageChange(event) {
+ this.pageChange.emit(event);
+ }
+
+ onPageSizeChange(event) {
+ this.pageSizeChange.emit(event);
+ }
}