您好我有一张桌子,我希望根据天数复选框进行过滤。过滤后我想拥有正确的分页总项目。有任何想法吗?
<div class="form-inline" id="overnightsDays">
<label translate="ratingCalculator.overnight.displayDays"></label>
<label ng-repeat="day in days">
<input type="checkbox" name="{{day.name}}" id="{{day.id}}" ng-model="day.checked" ng-init="selectedDays()" ng-change="selectedDays()">
<label class="overnights-display-rating margin-less" for="{{day.id}}" translate="ratingCalculator.overnight.{{day.name}}"> </label>
</label>
</div>
<div ng-if="vm.overnights.programs.length" id="overnightsTableData">
<table class="table table-bordered table-striped">
<thead>
<tr>
</tr>
</thead>
<tbody>
<tr ng-repeat="program in vm.tblOvernights.programs | filter: dayFilter">
</tr>
</tbody>
</table>
<ul uib-pagination total-items="How to get total items per each filtering" ng-model="vm.tblOvernights.currentPage" max-size="10" items-per-page="vm.tblOvernights.maxSize"
class="pagination-sm" boundary-link-numbers="true" force-ellipses="true" ng-click="vm.setTblOvernightsPage()"></ul>
</div>
答案 0 :(得分:0)
我认为你需要一个管道过滤器才能知道从哪开始
.filter('startFrom', [
function() {
return function(data, start) {
return data.slice(start);
};
}
]);
并在tr重复中实现
<tr ng-repeat="program in vm.tblOvernights.programs | filter: dayFilter |
startFrom:(vm.tblOvernights.currentPage -1) * vm.tblOvernights.pageSize | limitTo:
vm.tblOvernights.pageSize">
</tr>