【问题标题】:Template conditional logic is not working模板条件逻辑不起作用
【发布时间】:2012-02-10 09:32:49
【问题描述】:

在使用复选框的条件逻辑时存在一些问题 我尝试检查=真或假,但它不工作,在那里我选择模板中的条件逻辑,我想要检查=“检查”匹配条件

    <table border="1">
  <thead>
    <tr>
      <th>Department Name</th>
      <th>Test Name</th>
      <th>Sub Test Name</th>
    </tr>
  </thead>
  <tbody>
    {#foreach $T.d as post}
    <tr>
      <td>{$T.post.Dep_Name}</td>
      <td>{$T.post.Test_Name}</td>
      <td>{$T.post.Sub_Test_Name}</td>

      <td>
      {{if $T.post.Status==Checked}}
      <input id="chkResult" type="checkbox" checked="checked" />
        {{/if}}
        <input id="chkResult" type="checkbox" />
      </td>
      <td><input id="Button2" type="button" value="button" /></td>

    </tr>
    {#/for}
  </tbody>
</table>

【问题讨论】:

    标签: jquery-templates


    【解决方案1】:

    尝试使用类似的东西

     <input id="chkBox" type="checkbox" 
           {{if account.checkImage}} checked="checked"{{/if}} />
    

    你需要修改 {{if}} 中的逻辑,比如

     {{if $T.post.Status== "Checked" }} 
    

    猜你正在检查的条件是一个字符串。 如果您仍然遇到任何问题,请告诉我。

    【讨论】:

      【解决方案2】:

      我是这样工作的

      <input type="checkbox" id="chk${FeeSettingDetailID}" {{if IsRefundable}} checked{{/if}} />
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-10-04
        • 2012-12-14
        • 2015-09-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多