我将如何设置 html 表以使用粘性 header 并设置 StickyHeaderOffsetY 选项。
示例 https://bootstrap-table.com/docs/extensions/sticky-header/所有假设您正在使用 javascript 来填充表格,并且我找不到任何有关如何以其他方式设置选项的文档。
据我所知:
<table
data-toggle="table"
data-search="true"
data-sticky-header="true"
data-sortable="true"
data-show-columns="true"
class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c1abaea9af81a4b9a0acb1ada4efa2aeac" rel="noreferrer noopener nofollow">[email protected]</a></td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8be6eaf9f2cbeef3eae6fbe7eea5e8e4e6" rel="noreferrer noopener nofollow">[email protected]</a></td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0f657a63764f6a776e627f636a216c6062" rel="noreferrer noopener nofollow">[email protected]</a></td>
</tr>
</tbody>
</table>
最佳答案
抱歉我无法发表评论,但是你尝试一下吗?
<table
data-sticky-header="true"
data-sticky-header-offset-y="60"
></table>
关于bootstrap-table - 如何将粘性标题扩展与 html 数据表一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57470272/