Fixes the pagination on explore DMP and explore Datasets.

This commit is contained in:
gkolokythas 2019-05-17 10:17:23 +03:00
parent 162d2ef21f
commit add3f979b2
4 changed files with 12 additions and 3 deletions

View File

@ -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>

View File

@ -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();
}
}

View File

@ -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>

View File

@ -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();