【发布时间】:2019-05-31 15:28:57
【问题描述】:
我使用 jquery 数据表在表中显示我的列表。但有时对于单个 id,我必须在单个列中打印多个数据。结果我的专栏变大了。因此,如果该列中的数据溢出,我想使该列可滚动。
在 Files 列中,我有多个文件用于单个列。当有多个文件时,我想让该列可滚动。可能吗?在我的 html 中,我为 jquery 表编写了 java 脚本代码是
<script>
$(function () {
$("#currentAcrTable").DataTable({
"columnDefs": [
{ "targets": [1,2,3,4,5], "searchable": false },
{ "width": "15%", "targets": 4 }
]
});
$("#oldAcrTable").DataTable();
});
</script>
而我用于迭代循环和显示数据的 html 代码是
<tr th:each="acr : ${list}">
<td th:text="${acr.govtId}" align="center"></td>
<td th:text="${acr.year}" align="center"></td>
<td th:text="${acr.assigned_from}" align="center"></td>
<td th:text="${acr.assigned_to}" align="center"></td>
<td align="center">
<div class="scroll_y" style="overflow-x:hidden; overflow-y:scroll;">
<span th:each="file: ${acr.filelist}">
<a href=""><img th:src="@{/images/pdf-icon.png}" width="15px" height="15px"/></a>
</span>
</div>
</td>
</tr>
根据 Joseph_J 的回答,我在td 中添加了<div class="scroll_y" style="overflow-x:hidden; overflow-y:scroll;">。但是没有变化
【问题讨论】:
-
您只想滚动任何溢出数据的单元格?
-
是的!在我的表中,
Files列可能会溢出。所以我想让这个专栏只能滚动。
标签: javascript html spring-boot datatables thymeleaf