敲除阵列复选框未正确绑定

时间:2018-11-05 20:05:33

标签: knockout.js

我有一个HTML输入文本框,在它的change事件中,如果该特定输入框的id /行的head count> user count,我希望启用我的复选框。请帮忙。这是我的HTML代码:

<tbody data-bind="foreach: countryScopes.countryScopesData">
   <tr style="vertical-align: baseline">
      <td style="white-space:nowrap"><span data-bind="text: name" /></td>
      <td><span data-bind="text: level" style="text-align: left"/></td>
      <td><span data-bind="text: users"  style="text-align: center"/></td>
      <td>
         <input data-bind="textInput: lowHeadCount, event: { change: myAction }"  id="lowHeadCount" class="amount lowHeadCountClass"" style="text-align: center"  />
      </td>
      <td>                               
         <input type="checkbox" id="checkbox" name="checkbox" data-bind="click: enableCentralImp, checked: centralImpLowHeadCountFlag, enable: isAvailable && lowHeadCount"   />
      </td>                                
      <td>                                 
         <input data-bind="textInput: centralImpLowHeadCountpercent, enable: isAvailable && isPercentAvailable" class="amount lowHeadCountPercentClass" />% 
      </td>
      <td><span data-bind="text: Total.toFixed(2)" style="text-align: left"/></td>
      <td>$<span data-bind="text: Cost" style="text-align: left"/></td>
      <td> </td>
    </tr>
</tbody>

淘汰赛功能:

var Valuelowheadcount = this.lowHeadCount();
var countryId = this.id;
var HeadCountFlag = this.centralImpLowHeadCountFlag();
if (Valuelowheadcount > this.users) {
    this.isAvailable = true;
}
return true;

0 个答案:

没有答案