[英]How to increment serial number while using pagination in Angular.js
I need one help .i am using Angular.js dirPagination.js
for pagination of my table data but here my problem is suppose i fixed item per page is 5,the first 5 items is coming with serial no 1,2,3,4,5
but for second page again the serial no is starting from 1.I am adding my code below.我需要一个帮助。我正在使用 Angular.js
dirPagination.js
对我的表数据进行分页,但这里我的问题是假设我每页固定的项目是 5,前 5 个项目的序列号为1,2,3,4,5
但对于第二页,序列号从 1 开始。我在下面添加我的代码。
<tr dir-paginate="pro in ($parent.labelResults=(productDataList | filter:searchProduct)) | itemsPerPage:5" current-page="currentPage">
<td>{{itemsPerPage *(currentPage-1)+$index+1}}</td>
<td>{{pro.Product_name}}</td>
<td><img ng-src="upload/{{pro.image}}" name="pro" border="0" style="width:50px; height:50px; border:#808080 1px solid;" /></td>
<td>{{pro.Discount}}</td>
<td>{{pro.Offer}}</td>
<td>{{pro.unit_cost_price}}</td>
<td>{{pro.unit_sale_price}}</td>
<td>{{pro.quantity}}</td>
<td>{{pro.shipping_charge}}</td>
</tr>
<div class="pull-right">
<dir-pagination-controls max-size="5" direction-links="true" boundary-links="true" >
</dir-pagination-controls>
</div>
Here for each page of pagination the serial no is starting from 1.Here i need from the first page the serial no should starts from 1 and it should continue like 1,2,3....
so on.Please help me to resolve this issue.这里对于每一页分页,序列号从 1 开始。这里我需要从第一页开始,序列号应该从 1 开始,它应该像
1,2,3....
一样继续1,2,3....
等等。请帮我解决这个问题。
Could be achieved using
(ITEMS_PER_PAGE * (CURRENT_PAGE-1)) + $index+1
可以使用
(ITEMS_PER_PAGE * (CURRENT_PAGE-1)) + $index+1
<tr dir-paginate="pro in users | itemsPerPage:itemsPerPage" current-page="currentPage">
<td>{{itemsPerPage *(currentPage-1)+$index+1}}</td>
<td>{{pro.first_name}}</td>
<td>{{pro.last_name}}</td>
<td>{{pro.hobby}}</td>
</tr>
Controller:控制器:
$scope.currentPage=1;
$scope.itemsPerPage=5;
Sample Plunker demo示例Plunker 演示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.