I'm submitting a ... (check one with "x")
[ X] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
Current behavior
I am displaying a list using the new DataView. I am trying to access the index of the item being displayed like so
<p-dataView [value]="items" [paginator]="true" [rows]="20">
<p-header>My List</p-header>
<ng-template let-item let-i="index" pTemplate="listItem">
<div>
<childA *ngIf="item.type === 'typeA' " [item]="item" [index]="i"></childA>
<childB *ngIf="item.type === 'typeB' " [item]="item" [index]="i"></childB>
</ng-template>
</p-dataView>
I expect to be able to access the the index i of each item as before in the dataList. However this does not work with the new dataView.
This is already a feature.
If you check the demo and change the code below like this, you can access and display the index.
```
....
This is available.
When paginator is used, rowIndex starts with "0" again for every page instead of index of the object in array. Say array has 4 elements and each page contains 2 elements.
<ng-template let-car pTemplate="listItem" let-i="rowIndex">
<h1>
{{i}}
</h1>
the above code results in 0,1 and 0,1 on pagination instead of 0,1,2,3
@cagataycivici Any update on this? As @sarikaK945 mentioned, this added feature has a bug when dataview is used with pagination.
Most helpful comment
When paginator is used, rowIndex starts with "0" again for every page instead of index of the object in array. Say array has 4 elements and each page contains 2 elements.
<ng-template let-car pTemplate="listItem" let-i="rowIndex"> <h1> {{i}} </h1>the above code results in 0,1 and 0,1 on pagination instead of 0,1,2,3