Fixes the pagination on Dataset listing.
This commit is contained in:
parent
11c1ac33cf
commit
7c887382b5
|
@ -23,7 +23,7 @@
|
||||||
[showDivider]="i != (listingItems.length - 1)" (onClick)="rowClicked($event)">
|
[showDivider]="i != (listingItems.length - 1)" (onClick)="rowClicked($event)">
|
||||||
</app-dataset-listing-item-component>
|
</app-dataset-listing-item-component>
|
||||||
</div>
|
</div>
|
||||||
<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" class="mt-2">
|
<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" (page)="pageThisEvent()" class="mt-2">
|
||||||
</mat-paginator>
|
</mat-paginator>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -73,6 +73,7 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
|
if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10;
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
let fields: Array<string> = new Array();
|
let fields: Array<string> = new Array();
|
||||||
if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
|
if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
|
||||||
|
@ -90,6 +91,10 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pageThisEvent(event) {
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
rowClicked(dataset: DatasetListingModel) {
|
rowClicked(dataset: DatasetListingModel) {
|
||||||
this.router.navigate(['/datasets/edit/' + dataset.id]);
|
this.router.navigate(['/datasets/edit/' + dataset.id]);
|
||||||
}
|
}
|
||||||
|
@ -113,4 +118,4 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe();
|
.subscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue