Bootstrap表滤波器控件选择匹配子集
我正在使用Bootstrap-table和Bootstrap-table滤波器来过滤表中的结果,但是“选择”过滤器是匹配匹配过滤器的字符串子集。例如,如果我选择(不搜索)“燕麦”,我会在“ goatherd”以及“燕麦”的列中获得匹配项。显然,它是在进行某种字符串搜索,而不是匹配整个值。有没有办法改变这种行为?
示例HTML:
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></head>
<table id="table" data-url="json/data1.json" class="dataframe" data-filter-control="true" data-show-search-clear-button="true" data-show-filter-control-switch="true">
<thead>
<tr style="text-align: right;">
<th data-field="oats_goats" data-filter-control="select">Porridge or milk</th>
</tr>
</thead>
<tbody>[Insert data]</tbody>
</table>
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"</script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/extensions/filter-control/bootstrap-table-filter-control.min.js"></script>
<script>
$(function() {
$('#table').bootstrapTable()
})
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用列选项
filtertrictsearch
。&lt; th data-field =“ oats_goats” data-filter-control =“ select” data-filter-strict-search =“ true”&gt; porridge或porridge或牛奶&lt;/th&lt;/th&lt;/th&gt; /代码>
Try using the column option
filterStrictSearch
.https://bootstrap-table.com/docs/extensions/filter-control/#filterstrictsearch
<th data-field="oats_goats" data-filter-control="select" data-filter-strict-search="true">Porridge or milk</th>