我花了很多时间在ui-grid上找到当前的页码和总页数,我想用它来改变最后一页的网格高度。所以我想把它写下来。
答案 0 :(得分:0)
关键是使用gridApi
来记录页码的变化:
onRegisterApi: function(gridApi) {
$scope.gridApi = gridApi;
gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
paginationOptions.pageNumber = newPage;
paginationOptions.pageSize = pageSize;
$scope.pageSize = pageSize;
$scope.currentPage = newPage;
$scope.totalPage = Math.ceil($scope.gridOptions.totalItems/$scope.pageSize);
});
}
整个版本可以看到here in Plnkr