I have a table that is bound to an knockout observableArray:
<table class="table table-hover table-condensed">
<tbody data-bind="foreach: screens">
<tr data-toggle="collapse" href="#collapse"> // how can i bind the individual id?
<td><span data-bind="text: computerName"></span>
<!-- ko if: supporter -->
<span class="label label-primary">S</span>
<!-- /ko -->
</td>
<td data-bind="text: computerKennung"></td>
<td data-bind="text: nummer"></td>
<tr>
<tr data-bind="attr: { id: 'collapse' + oid}" class="collapse">
<td colspan="3">
<button class="btn btn-primary" data-bind="click: edit">Edit</button>
<button class="btn btn-primary" data-bind="click: delete">Delete</button>
</td>
</tr>
</tbody>
</table>
Every row should be clickable and collapse an additional row below, where i have buttons for actions. According to the bootstrap samples i need an id, which is called in the href-Target. But every row has a different oid and i don't know how many items are in the array.
Can i bind the href-Target via Knockout in any way? Is there a better way for collapsing a table row with unknown ids?