whenzhixin使用带有过滤器控制扩展名的Boostrap表。 http://bootstrap-table.wenzhixin.net.cn/extensions/#table-filter-control
我希望选择项中显示的选项按数字顺序排序。
可在以下位置找到代码:https://jsfiddle.net/yd75psoc/4
<script type="text/javascript" src="https://unpkg.com/jquery@3.3.1/dist/jquery.min.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.14.2/dist/bootstrap-table.min.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.14.2/dist/extensions/filter-control/bootstrap-table-filter-control.min.js"></script>
<table
id="table"
data-filter-control="true"
data-filter-show-clear="true">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price" data-filter-control="select">Item Price</th>
</tr>
</thead>
</table>
<script>
var $table = $('#table')
$(function() {
var data = [
{
'id': 0,
'name': 'Item 0',
'price': '$10'
},
{
'id': 1,
'name': 'Item 1',
'price': '$1'
},
{
'id': 2,
'name': 'Item 2',
'price': '$2'
}
]
$table.bootstrapTable({data: data})
})
</script>
您将看到以下顺序显示选项:1、10、2。 current behaviour
我需要这些值以数字顺序显示:1、2、10。
答案 0 :(得分:0)
这是您使用的filter-control
版本中的错误。
我已经编辑了您的代码,并且可以与我使用的filter-control
版本一起使用。
编辑的小提琴:https://jsfiddle.net/eitanmg/0y3tp4n7/1/
我正在使用的过滤器控制版本(并为您解决了问题):
只需将这个库替换为您的库,就可以了。