如何解决如何在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>
但是,在运行表时,在thead
和tfoot
部分中看不到标题名称。
表与下面的解决方案完美配合,但是我无法使行可折叠:
<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 举报,一经查实,本站将立刻删除。