Merge pull request #1761 from isocolsky/pagination
using foundation pagination directive
This commit is contained in:
commit
3c2e881acd
2 changed files with 9 additions and 20 deletions
|
|
@ -14,9 +14,16 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
$scope.currentPage = 1;
|
$scope.currentPage = 1;
|
||||||
$scope.itemsPerPage = 10;
|
$scope.itemsPerPage = 10;
|
||||||
$scope.nbPages = 0;
|
$scope.nbPages = 0;
|
||||||
|
$scope.totalItems = 0;
|
||||||
$scope.blockchain_txs = [];
|
$scope.blockchain_txs = [];
|
||||||
$scope.alternativeCurrency = [];
|
$scope.alternativeCurrency = [];
|
||||||
|
|
||||||
|
|
||||||
|
$scope.selectPage = function(page) {
|
||||||
|
$scope.currentPage = page;
|
||||||
|
$scope.update();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.update = function() {
|
$scope.update = function() {
|
||||||
$scope.getTransactions();
|
$scope.getTransactions();
|
||||||
};
|
};
|
||||||
|
|
@ -28,24 +35,6 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
}, 1);
|
}, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.nextPage = function() {
|
|
||||||
$scope.currentPage++;
|
|
||||||
$scope.update();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.previousPage = function() {
|
|
||||||
$scope.currentPage--;
|
|
||||||
$scope.update();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.hasNextPage = function() {
|
|
||||||
return $scope.currentPage < $scope.nbPages;
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.hasPreviousPage = function() {
|
|
||||||
return $scope.currentPage > 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.getTransactions = function() {
|
$scope.getTransactions = function() {
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
if (!w) return;
|
if (!w) return;
|
||||||
|
|
@ -72,6 +61,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
});
|
});
|
||||||
$scope.blockchain_txs = w.cached_txs = items;
|
$scope.blockchain_txs = w.cached_txs = items;
|
||||||
$scope.nbPages = res.nbPages;
|
$scope.nbPages = res.nbPages;
|
||||||
|
$scope.totalItems = res.nbItems;
|
||||||
|
|
||||||
|
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button ng-click="previousPage()" ng-disabled="!hasPreviousPage()">prev</button>
|
<pagination page="currentPage" total-items="totalItems" items-per-page="itemsPerPage" on-select-page="selectPage(page)" />
|
||||||
<button ng-click="nextPage()" ng-disabled="!hasNextPage()">next</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue