0

I have a table of users having different status.

HTML

<select class="form-control" id="sel1" data-ng-model="status" required>
    <option value="">Status</option>
    <option value="Open">Open</option>
    <option value="In-Progress">In-Progress</option>
    <option value="Rejected">Rejected</option>
    <option value="Verified">Verified</option>
    <option value="Closed">Closed</option>
</select>

<tbody>
     <tr data-ng-repeat="userDetails in (data | filter:status:status.status).slice(((currentPage-1)*itemsPerPage), ((currentPage)*itemsPerPage))">   
         <td> {{ userDetails.subDate | date : 'MM-dd-yyyy' }} </td>
         <td> {{ userDetails.fullName }} </td>
         <td> {{ userDetails.serviceType.serviceName }} </td>
         <td> {{ userDetails.status.status }} </td>
     </tr>
</tbody>

JS

$http.get('getAlldetails').success(function(response)
            {
                $scope.data = response;
                $scope.totalItems = response.length;
                $scope.viewby = 10;
                $scope.currentPage = 1;
                $scope.itemsPerPage = $scope.viewby;
                $scope.maxSize = 5; 

                $scope.setPage = function (pageNo) {
                    $scope.currentPage = pageNo;
                };

                $scope.setItemsPerPage = function(num) {
                    $scope.itemsPerPage = num;
                    $scope.currentPage = 1; 
                    }

                });

If there are 45 users, Pagination is happening properly. But If I try to view the list according to the status, it will display accordingly but total items count would be still 45 and there would be unnecessary blank page numbers even though it is not required. Any solution?

Protagonist
  • 1,649
  • 7
  • 34
  • 56

0 Answers0