如何添加滚动到Django呈现表? [英] How to add scroll to django rendered table?
本文介绍了如何添加滚动到Django呈现表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
height:500px
时,它会修改每一行的高度,而不是表格的高度,如果我添加 overflow-y:scroll
到表
, tbody
不起作用。行数取决于frame_list中存在多少帧。 如何为此表添加滚动条?
< table id =telemetry_table1>
< thead>
< tr>
帧标识符< / th>
帧到达日期< / th>
帧到达时间< th>
< / tr>
< / thead>
< tbody>
{frame for frame_list%中的帧%}
< tr>
< td> {{frame.frame_identifier_type}}< / td>
< td> {{frame.frame_arriving_time}}< / td>
< td> {{frame.frame_arriving_date}}< / td>
< / tr>
{%endfor%}
< / tbody>
< / table>
解决方案
修正了它,我只需将表格一个div并添加滚动。它可以工作。
So here's the table. When I give height:500px
it modifies each row's height and never the table's height and if I add overflow-y:scroll
to table
, tbody
it doesn't work. The number of rows depend on how many frames exist in frame_list.
How to add scroll for this table?
<table id="telemetry_table1">
<thead>
<tr>
<th>Frame identifier</th>
<th>Frame Arriving Date</th>
<th>Frame Arriving Time</th>
</tr>
</thead>
<tbody>
{% for frame in frame_list %}
<tr>
<td>{{frame.frame_identifier_type}}</td>
<td>{{frame.frame_arriving_time}}</td>
<td>{{frame.frame_arriving_date}}</td>
</tr>
{% endfor %}
</tbody>
</table>
解决方案
Fixed it, I just had to wrap the table in a div and add scroll to that. It works then.
这篇关于如何添加滚动到Django呈现表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文