mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
[DSC-389] pagination added.
This commit is contained in:
@@ -4,13 +4,18 @@
|
||||
[collectionSize]="objects?.payload?.totalElements"
|
||||
[sortOptions]="sortConfig"
|
||||
[hideGear]="hideGear"
|
||||
[objects]="objects"
|
||||
[hidePagerWhenSinglePage]="hidePagerWhenSinglePage"
|
||||
[hidePaginationDetail]="hidePaginationDetail"
|
||||
[showPaginator]="showPaginator"
|
||||
(pageChange)="onPageChange($event)"
|
||||
(pageSizeChange)="onPageSizeChange($event)"
|
||||
(sortDirectionChange)="onSortDirectionChange($event)"
|
||||
(sortFieldChange)="onSortFieldChange($event)"
|
||||
(paginationChange)="onPaginationChange($event)">
|
||||
(paginationChange)="onPaginationChange($event)"
|
||||
(prev)="goPrev()"
|
||||
(next)="goNext()"
|
||||
>
|
||||
<div class="card-columns row" *ngIf="objects?.hasSucceeded">
|
||||
<div class="card-column col col-sm-6 col-lg-4" *ngFor="let column of (columns$ | async)" @fadeIn>
|
||||
<div class="card-element" *ngFor="let object of column">
|
||||
@@ -22,3 +27,4 @@
|
||||
<ds-loading *ngIf="objects.isLoading" message="{{'loading.objects' | translate}}"></ds-loading>
|
||||
</ds-pagination>
|
||||
|
||||
|
||||
|
@@ -49,6 +49,11 @@ export class ObjectGridComponent implements OnInit {
|
||||
*/
|
||||
@Input() sortConfig: SortOptions;
|
||||
|
||||
/**
|
||||
* Whether or not the pagination should be rendered as simple previous and next buttons instead of the normal pagination
|
||||
*/
|
||||
@Input() showPaginator = true;
|
||||
|
||||
/**
|
||||
* The whether or not the gear is hidden
|
||||
*/
|
||||
@@ -134,6 +139,17 @@ export class ObjectGridComponent implements OnInit {
|
||||
* Event's payload equals to the newly selected sort field.
|
||||
*/
|
||||
@Output() sortFieldChange: EventEmitter<string> = new EventEmitter<string>();
|
||||
|
||||
/**
|
||||
* If showPaginator is set to true, emit when the previous button is clicked
|
||||
*/
|
||||
@Output() prev = new EventEmitter<boolean>();
|
||||
|
||||
/**
|
||||
* If showPaginator is set to true, emit when the next button is clicked
|
||||
*/
|
||||
@Output() next = new EventEmitter<boolean>();
|
||||
|
||||
data: any = {};
|
||||
columns$: Observable<ListableObject[]>;
|
||||
|
||||
@@ -225,4 +241,18 @@ export class ObjectGridComponent implements OnInit {
|
||||
this.paginationChange.emit(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to the previous page
|
||||
*/
|
||||
goPrev() {
|
||||
this.prev.emit(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to the next page
|
||||
*/
|
||||
goNext() {
|
||||
this.next.emit(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user