mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 12:33:07 +00:00
41914: DSO list with pagination from rest
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
<ds-pagination [paginationOptions]="config"
|
<ds-pagination [paginationOptions]="config"
|
||||||
[collectionSize]="(objects.payload | async)?.length"
|
[collectionSize]="(pageInfo | async)?.totalElements"
|
||||||
(pageChange)="config.currentPage = $event"
|
(pageChange)="config.currentPage = pageChange($event)"
|
||||||
(pageSizeChange)="config.pageSize = $event">
|
(pageSizeChange)="config.pageSize = pageSize($event)">
|
||||||
<ul *ngIf="objects.hasSucceeded | async">
|
<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>
|
<ds-object-list-element [object]="object"></ds-object-list-element>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</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 { RemoteData } from "../core/data/remote-data";
|
||||||
import { DSpaceObject } from "../core/shared/dspace-object.model";
|
import { DSpaceObject } from "../core/shared/dspace-object.model";
|
||||||
import { PaginationOptions } from "../core/cache/models/pagination-options.model";
|
import { PaginationOptions } from "../core/cache/models/pagination-options.model";
|
||||||
|
import { PageInfo } from "../core/shared/page-info.model";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -11,10 +16,11 @@ import { PaginationOptions } from "../core/cache/models/pagination-options.model
|
|||||||
styleUrls: ['./object-list.component.css'],
|
styleUrls: ['./object-list.component.css'],
|
||||||
templateUrl: './object-list.component.html'
|
templateUrl: './object-list.component.html'
|
||||||
})
|
})
|
||||||
export class ObjectListComponent {
|
export class ObjectListComponent implements OnInit {
|
||||||
|
|
||||||
@Input() objects: RemoteData<DSpaceObject[]>;
|
@Input() objects: RemoteData<DSpaceObject[]>;
|
||||||
@Input() config : PaginationOptions;
|
@Input() config : PaginationOptions;
|
||||||
|
pageInfo : Observable<PageInfo>;
|
||||||
data: any = {};
|
data: any = {};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -22,7 +28,10 @@ export class ObjectListComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
universalInit() {
|
universalInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.pageInfo = this.objects.pageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user