Fix: make sure paginator component reflects current page number.

This commit is contained in:
Arik Fraimovich
2018-08-05 17:57:55 +03:00
parent f96a0f338d
commit 1676d34af6
2 changed files with 4 additions and 16 deletions

View File

@@ -1,9 +1,6 @@
class PaginatorCtrl {
constructor() {
this.page = this.paginator.page;
}
pageChanged() {
this.paginator.setPage(this.page);
this.paginator.setPage(this.paginator.page);
}
}
@@ -13,7 +10,7 @@ export default function init(ngModule) {
<div class="paginator-container" ng-if="$ctrl.paginator.totalCount > $ctrl.paginator.itemsPerPage">
<ul uib-pagination total-items="$ctrl.paginator.totalCount"
items-per-page="$ctrl.paginator.itemsPerPage"
ng-model="$ctrl.page"
ng-model="$ctrl.paginator.page"
max-size="6"
class="pagination"
boundary-link-numbers="true"

View File

@@ -1,9 +1,6 @@
export default class LivePaginator {
constructor(rowsFetcher, {
page = 1,
itemsPerPage = 20,
orderByField,
orderByReverse = false,
page = 1, itemsPerPage = 20, orderByField, orderByReverse = false,
} = {}) {
this.page = page;
this.itemsPerPage = itemsPerPage;
@@ -14,13 +11,7 @@ export default class LivePaginator {
}
fetchPage(page) {
this.rowsFetcher(
page,
this.itemsPerPage,
this.orderByField,
this.orderByReverse,
this,
);
this.rowsFetcher(page, this.itemsPerPage, this.orderByField, this.orderByReverse, this);
}
setPage(page, pageSize) {