I have a mat table that contain checkboxes. A user is able to do operation on each row at a time. Once the operation of a particular row is completed, the number of time that particular row was invoked increases and its saved back to the database, then fetched back and displays on one of the columns of the same table using this column in desc order.
The problem is, when the numberOfOperations Updates, I have to do another get call to update the table column NumberOfOperations time so it uncheck the checkbox of the row that was operated on and makes it hard to keep track which row was operated on here is a snippet of code. My goal is to maintain the checkbox for the row operated on checked after the table datasource refreshes
<mat-checkbox(click)="$event.stopPropagation()"
(change)="$event ? selection.toggle(row.docId) : null"
[checked]="selection.isSelected(row)">
</mat-checkbox>
performOperation(){
//1. performs some operations once.
//2. calls the function thatshows how many times row was used
this.IncNumber()
}
//update the selected row.
IncNumber(){
this.myDataService.updateDataServices(this.objectId
.subscribe(data =>{
this.refresh()
})}
//refresh the table with updated data
refresh(){
getDataForTable();
}