<tr *ngFor="let data of rawDataListDup | filter:searchText | paginate: { itemsPerPage: 100,currentPage: q }; let idx = index">
<td>
<select (change)="AssigneeChange(data,$event.target.value,idx)">
<option [value]="data1.id" *ngFor="let data1 of groupList">{{ data1.name }}</option>
</select>
</td>
</tr>
Consider rawDataListDup
items as 300
. In above code idx
value reset to 0, when ever I go to next page in table.
AssigneeChange(data,id,idx){
console.log(data,id,idx)
}
Consider the current index of rawDataListDup
as 100
. In the console i get idx = 0
instead of idx = 100
when function AssigneeChange
is called. This happens when i am in page = 2
of table. In every page there will be 100 items.
How to solve this problem?
Please refer this for solution..
We can get absolute index using below code since paginate doesn't recognise it.