选择后如何保留Select2结果? [英] how to retain Select2 results after select?
本文介绍了选择后如何保留Select2结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,使用 select2多值时,用户输入了"新",并显示
For example, when using select2 muti-value, user entered 'new', and it showed
- 新墨西哥州
- 新罕布什尔州
- 新泽西州
- 纽约
- New Mexcio
- New Hampshire
- New Jersey
- New York
在选择" New Mexcio "之后,用户希望从剩余的3个剩余部分中再次选择.为此,用户必须再次输入"new".
After selecting 'New Mexcio', and the user would like to select again from the rest of the 3 remaining. In order to to do that, the user has to enter 'new' again.
是否可以保留结果而不是清除'查询?"
Is there a way to retain the results instead of clear out the 'query?
谢谢
推荐答案
听起来像您希望将查询从一个搜索持续到另一个搜索.您可能要签出nextSearchTerm
属性.
Sounds like you want to persist a query from one search to the next. You might want to check out the nextSearchTerm
property.
要在下次搜索中显示当前值,
To display the current value in the next search,
function displayCurrentValue(selectedObject, currentSearchTerm) {
return currentSearchTerm;
}
$("#e1").select2({
nextSearchTerm: displayCurrentValue
});
这篇关于选择后如何保留Select2结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文