未对记录进行排序时,索引似乎是正确的,并在我的单击功能上显示了正确的记录。如果按列排序,则显示不正确的记录。对列进行排序后,如何从“ onClick”功能中获取正确的上传记录?
<ng-container matColumnDef="actionsColumn">
<mat-header-cell *matHeaderCellDef>
Archive
</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index;">
<button mat-icon-button color="primary" focusable="false" (click)="removeUpload(uploads.data[i])">
<i class="fa fa-times mat-icon"></i>
</button>
</mat-cell>
</ng-container>
上传功能:
removeUpload(upload : Upload){
//when sorting, incorrect upload record is displayed on click
}