I have searched the web for a decent example of primeng datatable with rowTrackBy. Documentation is incomplete and does not say much. Is there anyone out there that can help?
4
votes
2 Answers
5
votes
4
votes
Just wanted to show where and how to use rowTrackBy in table template as well in this answer:
<p-table #tt [value]="data" [lazy]="true" (onLazyLoad)="loadDataLazily($event)" [paginator]="true"
[rows]="dataSize" [totalRecords]="totalRecords"
[rowsPerPageOptions]="[10,20,30]" [rowTrackBy]="trackByFunction">
trackByFunction = (index, item) => {
return item.id // O index
}