I added this but when inspecting element using Chrome DevTools, the click function doesn't show!
Here's my code:
<mat-table [dataSource]="dataSource1" class="mat-table"> <!-- Position Column --> <ng-container matColumnDef="Objname"> <mat-header-cell *matHeaderCellDef> ObjName </mat-header-cell> <mat-cell *matCellDef="let element"> {{element.objname}} </mat-cell> </ng-container> <!-- Weight Column --> <ng-container matColumnDef="Successcount"> <mat-header-cell *matHeaderCellDef> Successcount </mat-header-cell> <mat-cell *matCellDef="let element"> {{element.successcount}} </mat-cell> </ng-container> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-row (click)="getRecord(element.objname)" *matRowDef="let row; columns: displayedColumns;"></mat-row> </mat-table>
almost the same solution as above but a bit more useful if you are trying to get the object from the clicked row
<mat-row *matRowDef="let row; columns: displayedColumns;" (click)="getRecord(row)"></mat-row>
when you console log the row you will get the entire object of the row
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With