【发布时间】:2021-03-17 10:00:40
【问题描述】:
我想要一个水平滚动条到我的表格。
HTML代码:
如您所见,我已经使用了引导程序,但它仍然无法正常工作。在其他模块中它工作正常。 调用 ajax 后添加 tbody 数据。
我也尝试过:
overflow-x: auto
white-space: nowrap
数据未正确显示在右侧:它超出了屏幕尺寸,我必须将其缩小才能看到整个表格。
<div class="modal fade" id="new-modal">
<div class="tble-grid-wrapper">
<div class="table-responsive pl-3 pr-3">
<table id="selectedDevices" class="table table-sm table-striped" class="display">
<thead>
<tr>
<th>HEADER 1</th>
<th>HEADER 2</th>
<th>HEADER 3</th>
<th>HEADER 4</th>
<th>HEADER 5</th>
<th>HEADER 6</th>
<th>HEADER 7</th>
<th>HEADER 8</th>
<th>HEADER 9</th>
<th>HEADER 10</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
【问题讨论】:
-
将您的表格包含在一个 div 中。将此 div 限制为 100% 宽度。将
overflow-x:auto添加到此 div。
标签: javascript html css ajax bootstrap-4