0
我有以下knockoutJS模板:如何訪問淘汰賽模板的每個單獨屬性?
<tbody data-bind="template: { name: 'Rows', foreach: model.items }"> </tbody>
及其使用:
<script type="text/html" id="Rows">
<tr>
<td><select data-bind="options: $parent.model.Reasons, value: ReissueReason"></select></td>
<td><input data-bind="value: ReissueRoad" class="lookUpRoads"></td>
<td><input data-bind="value: HoursReissued"></td>
<td><input data-bind="value: TimeRate"></td>
<td><input data-bind="value: ReissuePaymentAmount"></td>
<td><input data-bind="value: Comment" style="width: 300px"></td>
</tr>
在服務器模型類我有一個創建三個「項目」,這樣一個列表中選擇模板屏幕上有3行。 我想要訪問單個行數據,例如我需要編寫一個函數,當用戶將一個值輸入到HoursReissued輸入框中時觸發onBlur,並捕獲該項目類的信息。 (C# - models.item [0]) 我還需要能夠基於onblur函數更新行中的其他字段 - 例如:應根據HoursReissued和TimeRate字段的值自動更新ReissuePaymentAmount。