如何将粘性 header 扩展与 html 数据 table 一起使用?

How use sticky header extension with html data table?

我将如何设置 html table 以使用粘性 headers 并设置 stickyHeaderOffsetY 选项。

例子 https://bootstrap-table.com/docs/extensions/sticky-header/ 都假定您正在使用 javascript 来填充 table,我找不到任何关于如何以其他方式设置选项的文档。

据我所知:

<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>john@example.com</td>
      </tr>
      <tr>
        <td>Mary</td>
        <td>Moe</td>
        <td>mary@example.com</td>
      </tr>
      <tr>
        <td>July</td>
        <td>Dooley</td>
        <td>july@example.com</td>
      </tr>
    </tbody>
</table>

抱歉我不能发表评论,但你试试这个吗?

<table
  data-sticky-header="true"
  data-sticky-header-offset-y="60"
></table>