I have the following code (simplified for easy reading) for editing a big grid view. The knockout script will generate hidden edit row for each row. clicking the "Edit" button will unhide the row so users can edit the value. Several html <select>
controls have many <option>
tags so the generated html is huge.
Is it possible to dynamically insert a editing row after click the "Edit" button? Or is there a better way to handle this common case using knockout/jQuery?
<table>
<thead>.... </thead>
<tbody data-bind="foreach: Contacts">
<tr data-bind="visible: isEditing==false">
<td><span data-bind="text:Name"></span></td>
<td><span data-bind="text: Phone"></span></td>
<td><span data-bind="text: State"></span></td>
<td><a href="#" data-bind="click: startEdit">Edit</a></td>
</tr>
<tr data-bind="visible: isEditing">
<td>
First Name:<input data-bind="value: FirstName" />
Last Name:<input data-bind="value: LastName" />
</td>
<td><input data-bind="value: Phone" /></td>
<td><select data-bind="value: State">...huge options...</select></td>
<td><a href="#" data-bind="click: updateContact">Done</a></td>
</tr>
</tbody>