mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 04:23:04 +00:00
41914: DSO list with pagination from rest
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<ds-pagination [paginationOptions]="config"
|
||||
[collectionSize]="(objects.payload | async)?.length"
|
||||
(pageChange)="config.currentPage = $event"
|
||||
(pageSizeChange)="config.pageSize = $event">
|
||||
[collectionSize]="(pageInfo | async)?.totalElements"
|
||||
(pageChange)="config.currentPage = pageChange($event)"
|
||||
(pageSizeChange)="config.pageSize = pageSize($event)">
|
||||
<ul *ngIf="objects.hasSucceeded | async">
|
||||
<li *ngFor="let object of (objects.payload | async) | paginate: { itemsPerPage: config.pageSize, currentPage: config.currentPage, totalItems: (objects.payload | async)?.length }">
|
||||
<li *ngFor="let object of (objects.payload | async) | paginate: { itemsPerPage: (pageInfo | async)?.elementsPerPage, currentPage: (pageInfo | async)?.currentPage, totalItems: (pageInfo | async)?.totalElements }">
|
||||
<ds-object-list-element [object]="object"></ds-object-list-element>
|
||||
</li>
|
||||
</ul>
|
||||
|
@@ -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<DSpaceObject[]>;
|
||||
@Input() config : PaginationOptions;
|
||||
pageInfo : Observable<PageInfo>;
|
||||
data: any = {};
|
||||
|
||||
constructor() {
|
||||
@@ -22,7 +28,10 @@ export class ObjectListComponent {
|
||||
}
|
||||
|
||||
universalInit() {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.pageInfo = this.objects.pageInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user