2
녹아웃을 사용하여 바인딩 된 표 데이터가 있습니다. 여기에는 부모와 같은 행이 있습니다. 예 :녹아웃 바인딩의 어린이를위한 설정 탭 색인
<tr>
<td>
<select data-bind="value:Required, enable:RequiredActive, attr:{tabindex: 43 * ($index() + 1) }">
<option value="E">Eligible</option>
<option value="O">On</option>
<option value="F">Off</option>
</select>
</td>
<td>
<input data-bind="value:SetupTime, attr: { title: tabindex: 44 * ($index() + 1) }"/>
<input data-bind="value:CloseTime, attr: { title: tabindex: 45 * ($index() + 1) }" />
</td>
<td>
<table>
<tbody data-bind="foreach: WorkSegments">
<tr>
<td>
<select data-bind="options:Locations, value:Location, optionsText: 'Name', optionsValue: 'ID', attr:{tabindex: 49 * ($parentContext.$index + 1) }" >
</select>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody data-bind="foreach: WorkSegments">
<tr>
<td>
<select class="combobox" data-bind="options:EmployeeRoles, value:Role, optionsText: 'Name', optionsValue: 'ID', attr:{tabindex: 49 * ($parentContext.$index + 1)}" >
</select>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
여기에서 Location 및 EmployeeRole 드롭 다운은 하위이며 상위 내에서 여러 번 발생할 수 있습니다. 따라서 탭 인덱스를 설정할 때 '$ parentContext. $ index'를 사용했지만 런타임에 모든 하위 컨트롤에 대해 tabindex = 'NAN'이 표시됩니다.
$ parent.index() 운이 없다.
다음<select data-bind="options:Locations, value:Location, optionsText: 'Name', optionsValue: 'ID', attr:{tabindex: 49 * ($parentContext.$index() + 1) }" >
</select>
하는 작업 예 :
당신은 아닌 $parent.index()
을 $parentContext.$index()
를 사용해야합니다 도움이
thnks을, 그 일을! 내 실수는 $ parentContext 대신 $ parentContext. $ index를 사용했다는 것입니다. $ index() – devC