Commit add3f979 authored by Georgios Kolokythas's avatar Georgios Kolokythas

Fixes the pagination on explore DMP and explore Datasets.

parent 162d2ef2
......@@ -22,8 +22,7 @@
<div class="row" *ngFor="let item of listingItems; let i = index">
<app-explore-dataset-listing-item-component class="col-12" [dataset]="item" [showDivider]="i !== (listingItems.length - 1)" (onClick)="rowClicked($event)"></app-explore-dataset-listing-item-component>
</div>
<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator>
<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" (page)="pageThisEvent($event)"></mat-paginator>
</div>
</div>
</div>
......
......@@ -43,6 +43,7 @@ export class ExploreDatasetListingComponent extends BaseComponent implements OnI
}
refresh() {
if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10;
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array();
if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
......@@ -72,4 +73,8 @@ export class ExploreDatasetListingComponent extends BaseComponent implements OnI
// }
return defaultCriteria;
}
pageThisEvent(event) {
this.refresh();
}
}
......@@ -23,7 +23,7 @@
<div class="row" *ngFor="let item of listingItems; let i = index">
<app-explore-dmp-listing-item-component class="col-12" [showDivider]="i !== (listingItems.length - 1)" [dmp]="item" (onClick)="rowClicked($event)"></app-explore-dmp-listing-item-component>
</div>
<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]"></mat-paginator>
<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" (page)="pageThisEvent($event)"></mat-paginator>
</div>
</div>
</div>
......
......@@ -43,6 +43,7 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
}
refresh() {
if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10;
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array();
if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
......@@ -70,6 +71,10 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
this.refresh();
}
pageThisEvent(event) {
this.refresh();
}
// @ViewChild(MatPaginator) _paginator: MatPaginator;
// @ViewChild(MatSort) sort: MatSort;
// criteria: ExploreDmpCriteriaModel = new ExploreDmpCriteriaModel();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment