如何在DataTables表中安装可折叠行?

问题描述

我正在尝试遵循此示例(https://jsfiddle.net/gyrocode/2u650u18/),并在表的某些列上安装可折叠的行。

数据表:

<table id="example" class="display" style="width:100%">
  <thead>

            <tr>
      {% for i in cols %}
      <th>{{ i.id }}</th>
      <th>{{ i.name }}</th>
      <th class="none">{{ i.31082020 }}</th>
      <th class="none">{{ i.difference }}</th>
      <th class="none">{{ i.01092020 }}</th>
      <th class="none">{{ i.difference1 }}</th>
      <th class="none">{{ i.02092020 }}</th>
      <th class="none">{{ i.difference2 }}</th>
      <th class="none">{{ i.03092020 }}</th>
      <th class="none">{{ i.difference3 }}</th>
      <th class="none">{{ i.04092020 }}</th>
      <th class="none">{{ i.difference4 }}</th>
      <th class="none">{{ i.05092020 }}</th>
      <th class="none">{{ i.difference5 }}</th>
      <th class="none">{{ i.06092020 }}</th>
      <th>{{ i.AverageDifference }}</th>
      <th>{{ i.Total }}</th>
      {% endfor %}
            </tr>
        </thead>
        <tbody>
     {% for k in range(data|length) %}
 
    <tr>
      <td> <a href="{{ url_for('static',filename='ids/' + data.iloc[k,0]|string)+'.html' }}"> {{data.iloc[k,0]}} </a> </td>
      {% for j in cols[1:]  %}
      <td> {{data.iloc[k][j]}} </td>
      {% endfor %}
    </tr>

     {% endfor %}
             </tbody>
        <tfoot>
            <tr>
           {% for i in cols %}
            <th>{{ i.id }}</th>
      <th>{{ i.name }}</th>
      <th>{{ i.31082020 }}</th>
      <th>{{ i.difference }}</th>
      <th>{{ i.01092020 }}</th>
      <th>{{ i.difference1 }}</th>
      <th>{{ i.02092020 }}</th>
     <th>{{ i.difference2 }}</th>
      <th>{{ i.03092020 }}</th>
      <th>{{ i.difference3 }}</th>
      <th>{{ i.04092020 }}</th>
      <th>{{ i.difference4 }}</th>
      <th>{{ i.05092020 }}</th>
      <th>{{ i.difference5 }}</th>
      <th>{{ i.06092020 }}</th>
      <th>{{ i.AverageDifference }}</th>
      <th>{{ i.Total }}</th>

      {% endfor %}
            </tr>
        </tfoot>
  </table>

但是,在运行表时,在theadtfoot部分中看不到标题名称

表与下面的解决方案完美配合,但是我无法使行可折叠:

 <table id="example" class="display" style="width:100%">
  <thead>
            <tr>
      {% for i in cols %}
      <th> {{i}} </th>
      {% endfor %}
            </tr>
        </thead>
        <tbody>
     {% for k in range(data|length) %}
 
    <tr>
      <td> <a href="{{ url_for('static',0]}} </a> </td>
      {% for j in cols[1:]  %}
      <td> {{data.iloc[k][j]}} </td>
      {% endfor %}
    </tr>

     {% endfor %}
             </tbody>
        <tfoot>
            <tr>
           {% for i in cols %}
      <th> {{i}} </th>
      {% endfor %}
            </tr>
        </tfoot>
  </table>

有人可以帮助您吗?预先感谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)