向Django模板选项卡中的特定行添加图标

2024-09-30 10:37:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在研究pythondjango模板,其中有一个表的列为id、factor a、factor B、factor C。id、系数A、系数B和系数C的值分别为79、0.56、1.1和1.3。在

enter image description here

html模板的代码如下:

<table class="table table-bordered">
  <thead>
    <tr>
      <th class="text-center">id</th>
      <th class="text-center">Factor A</th>
      <th class="text-center">Factor B</th>
      <th class="text-center">Factor C</th>
    </tr>
  </thead>
  <tbody >
    <tr ng-class="{'info':aggregateData.Mode, 'closed':!aggregateData.Open}">
      <td class="text-center">{{aggregateData.id}}</td>
      <td class="text-center">{{aggregateData.factor_a}}</td>
      <td class="text-center">{{aggregateData.factor_b}}</td>
      <td class="text-center">{{aggregateData.factor_c}}</td>
    </tr>
  </tbody>
</table

我想添加一个可点击的图标,类似于这样的行有聚合数据。打开是的。 enter image description here

有人能给我一个建议吗。在


Tags: text模板idtabletrclasstdcenter
1条回答
网友
1楼 · 发布于 2024-09-30 10:37:03

试试这个。在

<table class="table table-bordered">
  <thead>
    <tr>
      <th class="text-center">id</th>
      <th class="text-center">Factor A</th>
      <th class="text-center">Factor B</th>
      <th class="text-center">Factor C</th>
    </tr>
  </thead>
  <tbody >
    <tr ng-class="{'info':aggregateData.Mode, 'closed':!aggregateData.Open}">
      <td class="text-center">{{aggregateData.id}}</td>
      <td class="text-center">{{aggregateData.factor_a}}</td>
      <td class="text-center">{{aggregateData.factor_b}}</td>
      <td class="text-center">{{aggregateData.factor_c}}</td>
      {% if aggregateData.open == True %}
        <td class="text-center">
          <a href="https://www.google.co.in">
            <img src="/path_toicon.png">    
          </a>
        </td>
      {% endif %}
    </tr>
  </tbody>
</table>

相关问题 更多 >

    热门问题