【发布时间】:2015-11-02 12:22:57
【问题描述】:
我正在尝试将 DataTable 与 Twitter 引导选项卡一起使用,为此我正在尝试以下代码,它成功调用 dataTable 并创建了 dataTable,但对于 tab2 DataTable 标头未对齐
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Data table 1</a>
</li>
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Data table 2</a>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<table class="table" id="table1">
<thead>
<tr>
<th>#</th>
<th>First table</th>
<th>First table</th>
<th>First table</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
</tbody>
</table>
</div>
<div role="tabpanel" class="tab-pane" id="profile">
<table class="table" id="table2">
<thead>
<tr>
<th>#</th>
<th>second table</th>
<th>second table</th>
<th>second table</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
当我添加 scrollY 时,标题会不对齐
【问题讨论】:
标签: javascript jquery twitter-bootstrap datatable