I am using a data grid throughout my application, and currently, I am retrieving the selected rowid with the following code.
Here is the HTML snippet:
<tbody>
<tr *ngFor="let ddata of tableData.data; let i = index" (click)="setClickedRow(ddata)" [class.active]="ddata.discountauthorizationid == selectedRow">
<td *ngFor="let dr of tableData.record | paginate: { itemsPerPage: pageItem, currentPage: p }">{{ddata[dr]}}</td>
</tr>
</tbody>
In the component.ts
file, I handle this as follows:
this.selectedRow = ddata.discountauthorizationid;
console.log("You selected!",ddata.discountauthorizationid);
this.dataService.changeMessage(ddata.discountauthorizationid);
Now, I aim to make this process entirely dynamic by defining the primary id like this:
@Input() primaryid: string
I would like to access data.(some_primaryid)
in a way that resembles accessing an array using keys. Can this be achieved? If so, could you provide guidance on how to do it?