Zizzamia / ng-tasty

A tasty collection of reusable UI components for Angular, like grandma used to make. Like Table directive, WebSocket / Debounce / Throttle service, Range / Camelize / Slugify filters
MIT License
435 stars 64 forks source link

pagination can't show the max page #154

Closed baijiezi closed 9 years ago

baijiezi commented 9 years ago

Hello: I return the pagination form the js file like this:

'pagination': {
              "count": 100,
              "page": 1,
              "pages": 22,
              "size": 2158
            }

When I click the remaining button to change pages, it can show page 16, but can't show the page 22.

on the right of the page,it show this info: Page 1 of 22, of 2158 entries

Zizzamia commented 9 years ago

I had problem to recreate the bug, can you please show me your implementation.

baijiezi commented 9 years ago

angular.module('healthApp') .controller('HospitalReport2Ctrl', ['$rootScope', '$scope', '$state', '$http','$filter', function ($rootScope, $scope, $state, $http, $filter, $cookieStore) { $scope.startDate = new Date(new Date()-1000_60_60_24_2); $scope.endDate = new Date(new Date()-1000_60_60*24); $scope.templateUrl = 'views/templates/p.html'; $scope.count = 100; $scope.page = 1;

  $scope.init = {
    'count': $scope.count,
    'page': $scope.page
  };
  $scope.filterBy = {
    'startDate': $filter('date')($scope.startDate, 'yyyy-MM-dd'),
    'endDate': $filter('date')($scope.endDate, 'yyyy-MM-dd')
  };
  $scope.getResource = function (params, paramsObj) {
    params = params.replace(new RegExp('count', 'g'), 'per_page');
    var urlApi = restUrl + '/statements/hospitalTransRecord?' + params;
    return $http.get(urlApi).then(function (response) {
      return {
        'rows': response.data.data.pageList,
        'header': [
          {
            "key": "hospitalName",
            "name": "Hospital"
          },
          {
            "key": "merchantId",
            "name": "MerchanId"
          },
          {
            "key": "payCardNo",
            "name": "PayCard"
          }
        ],
        'pagination': {
          "count": response.data.data.pageSize,   //100
          "page": response.data.data.curPage,     //1
          "pages": response.data.data.totalPage,  //9
          "size": response.data.data.totalCount   //852
        }
      }
    });
  }

}])

baijiezi commented 9 years ago
HospitalReport2
{{ row.hospitalName }} {{ row.merchantId }} {{ row.payCardNo }}
baijiezi commented 9 years ago

page1

page2

baijiezi commented 9 years ago

The problem has been resolved by update ng-tasty to v0.5.7. Thank you.

Zizzamia commented 9 years ago

Yeee :-) :+1: ThankYou