From 03208c8261bea5789917938d4de9b633c23b9623 Mon Sep 17 00:00:00 2001 From: Lotte Hofstede Date: Wed, 14 Jun 2017 15:03:41 +0200 Subject: [PATCH] 41914: DSO list with pagination from rest --- src/app/object-list/object-list.component.html | 8 ++++---- src/app/object-list/object-list.component.ts | 13 +++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/app/object-list/object-list.component.html b/src/app/object-list/object-list.component.html index 788377917c..d1b0ce4578 100644 --- a/src/app/object-list/object-list.component.html +++ b/src/app/object-list/object-list.component.html @@ -1,9 +1,9 @@ + [collectionSize]="(pageInfo | async)?.totalElements" + (pageChange)="config.currentPage = pageChange($event)" + (pageSizeChange)="config.pageSize = pageSize($event)"> diff --git a/src/app/object-list/object-list.component.ts b/src/app/object-list/object-list.component.ts index fe7060a4f3..0454022554 100644 --- a/src/app/object-list/object-list.component.ts +++ b/src/app/object-list/object-list.component.ts @@ -1,7 +1,12 @@ -import { Component, Input, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core'; +import { + Component, Input, ViewEncapsulation, ChangeDetectionStrategy, + OnInit +} 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"; @Component({ @@ -11,10 +16,11 @@ import { PaginationOptions } from "../core/cache/models/pagination-options.model styleUrls: ['./object-list.component.css'], templateUrl: './object-list.component.html' }) -export class ObjectListComponent { +export class ObjectListComponent implements OnInit { @Input() objects: RemoteData; @Input() config : PaginationOptions; + pageInfo : Observable; data: any = {}; constructor() { @@ -22,7 +28,10 @@ export class ObjectListComponent { } universalInit() { + } + ngOnInit(): void { + this.pageInfo = this.objects.pageInfo; } }