gpt4 book ai didi

javascript - bootstrap-table 中的 table-multiple-sort 不适用于一页中的多个表

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:58:55 24 4
gpt4 key购买 nike

我使用 bootstrap-table和扩展 table-multiple-sort .当我在一页中有两个表时(在我的例子中,第二个表在模式窗口中),在第二个表中我没有任何选择进行多重排序。

jsfiddle

html

<table ref="mainTable" className="table table-striped table-bordered table-hover" cellSpacing="0" id="mainTable" data-show-toggle="true" data-show-columns="true" data-search="true" data-pagination="true">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="Customer Name" data-halign="center"
data-align="left" data-sortable="true">Customer Name</th>
<th data-field="Location Type" data-halign="center"
data-align="left" data-sortable="true">Location Type</th>
<th data-field="Location" data-halign="center"
data-align="left" data-sortable="true">Location</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>Cap Corp</td>
<td>Main</td>
<td>Norwalk CT 06851</td>
</tr>
<tr>
<td></td>
<td>Cap Corp</td>
<td>Other</td>
<td>Norwalk CT 06851</td>
</tr>
<tr>
<td></td>
<td>Tel</td>
<td>Main</td>
<td>Slough SL1 4DX</td>
</tr>
<tr>
<td></td>
<td>Tel</td>
<td>Other</td>
<td>London W1B 5HQ</td>
</tr>
</tbody>
</table>



<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<table class="table table-striped table-bordered table-hover" cellspacing="0" id="modalTable" data-click-to-select="true" data-show-toggle="true" data-show-columns="true" data-search="true" data-pagination="true">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="name">Name</th>
<th data-field="stargazers_count">Stars</th>
<th data-field="forks_count">Forks</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>ala</td>
<td>234</td>
<td>Norwalk CT 06851</td>
</tr>
<tr>
<td></td>
<td>ala</td>
<td>234</td>
<td>Norwalk CT 06851</td>
</tr>
<tr>
<td></td>
<td>ala</td>
<td>234</td>
<td>Slough SL1 4DX</td>
</tr>
</tbody>
</table>

</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>

javascript

$('#mainTable').bootstrapTable({
showFilter: true,
showMultiSort: true
});

$('#modalTable').bootstrapTable({
showFilter: true,
showMultiSort: true
});

最佳答案

您的模态表格标题缺少 data-sortable="true" 属性:

<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="Customer Name" data-halign="center"
data-align="left" data-sortable="true">Customer Name</th>
<th data-field="Location Type" data-halign="center"
data-align="left" data-sortable="true">Location Type</th>
<th data-field="Location" data-halign="center"
data-align="left" data-sortable="true">Location</th>
</tr>
</thead>

关于javascript - bootstrap-table 中的 table-multiple-sort 不适用于一页中的多个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32504520/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com