user2281858
user2281858

Reputation: 1997

bootstrap-table fixed header not working

I have used bootstrap-table to set a table in my project. Everything works fine except scroll bar inside the tbody.

There is no scroll bar there. What am I missing? I believe if the scroll-bar is visible then the fixed-header for the table feature should also work fine.

<table id="tblMain" class="table table-bordered table-hover" data-show-refresh="false" data-click-to-select="false" data-single-select="true" data-show-toggle="false" data-show-columns="false" data-cache="false" data-page-number="@Model.CommonVariable" data-url='@Url.Action("Index", "Home")'  data-side-pagination="server" data-pagination="true" data-search="false" data-query-params="queryParams" data-response-handler="respHandler">
    <thead class="table-head">
        <tr>
            <th data-field="id" data-formatter="SomeFunction">Item ID</th>
            <th data-field="name" data-formatter="SomeFunction2">Item Name</th>
            <th data-field="price" data-formatter="SomeFunction3">Item Price</th>
        </tr>
    </thead>
</table>

Upvotes: 4

Views: 4862

Answers (2)

wenyi
wenyi

Reputation: 1384

You can set the data-height option to active fixed-header feature, for example: http://issues.wenzhixin.net.cn/bootstrap-table/.

Upvotes: 2

Travis
Travis

Reputation: 2245

Check out this fiddle...

This was not created by me but i think it is what you are looking for.

    table {
        table-layout:fixed;
    }

    .div-table-content {
      height:150px;
      overflow-y:auto;
    }

Upvotes: 2

Related Questions