I have a table in an HTML file used in an Angular application. I need to retrieve the user orders and list the orders in the table. if the user clicks on the Review button, I want the user to be able to see the related order items for this specific order. The review button should expand a new row containing the related order items. How to achieve this programmatically? I have tried passing the order id as the id of the row but unfortunately, this does not work.
<script type="text/javascript">
function show_hide_row(row) {
$("#" + row).toggle();
}
</script>
<table class="table" cellpadding=10>
<caption>The total amount of orders is {{orders.length}}</caption>
<tbody *ngFor="let order of orders" >
<td>
<a class="link" style="font-weight: bold; cursor: pointer;" onclick="show_hide_row(order.orderId);">Review</a>
</td>
</tr>
<tr id="{{order.orderId}}" class="hidden_row">
<p>Here comes the related order items for the expanded order</p>
</tr>
</tbody>
</table>
Any help would be much appreciated! Thanks.