[英]Bootstrap-Select Data Live Search, search by data tokens AND value
When you use the bootstrap select picker with live search, it will search by whatever option values are. 当您使用带有实时搜索的引导选择选择器时,它将按任何选项值进行搜索。
But when you add data-tokens, it then only searches by the data tokens. 但是当您添加数据令牌时,它只会按数据令牌进行搜索。 Is there a way I can make it search by both?
有没有办法可以让它同时搜索? Or should I be using data-subtext instead so that both things are searchable?
或者我应该使用数据子文本,以便两个东西都可以搜索?
I did this by including the value in the data tokens. 我通过在数据令牌中包含值来做到这一点。 Ended up with options that looked like this
结束了看起来像这样的选项
<option data-tokens='AVAS AV Accessories'>AV Accessories</option>
In this instance, the data-token only needed to be AVAS, the stock code for AV Accessories but I added the value since adding the token stopped the live search looking at the value. 在这种情况下,数据令牌只需要AVAS,AV附件的股票代码,但我添加了值,因为添加令牌停止了实时搜索查看值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.