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 ing 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.
<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.
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 ing 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.
<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.
- Consider Page Number as well... – Rayon Commented Mar 28, 2016 at 4:18
- @RayonDabre: not getting you.Can you please give any solution? – satya Commented Mar 28, 2016 at 4:23
-
If I read you right, If there are 5 items in each page and 10 items in total, you expect
6,7,8..
in the next page right ? – Rayon Commented Mar 28, 2016 at 4:24 -
It could be achieved using
(ITEMS_PER_PAGE * (CURRENT_PAGE-1)) + $index+1
– Rayon Commented Mar 28, 2016 at 4:32 - Where i will write this.Can you edit your answer in my code please? – satya Commented Mar 28, 2016 at 4:35
1 Answer
Reset to default 18Could be achieved using
(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