用select2 支持搜索,value是拼音,文本是汉字。发现经常不知道输入什么,于是想支持两种方式。官方提供了方法。
function myMatcher(term, text, option) {
return text.toUpperCase().indexOf(term.toUpperCase()) >= 0 || option.id.toUpperCase().indexOf(term.toUpperCase())>=0;
}
$(document).ready(function() {
$.fn.select2.amd.require(['select2/compat/matcher'], function (oldMatcher) {
$("#id_dev_user").select2({ matcher: oldMatcher(myMatcher), placeholder: "选择人员", allowClear: true })
});
});
上一篇: mac给virtualbox虚拟机硬盘扩容
下一篇: virtualenv源码阅读
相关文章:
- 网页中嵌入特殊字体
- 结构化Web编程语言Dart
- Google jsAPI托管你的js库
- 在线网站检测工具
- django发送json数据并格式化datetime时间数据
- django 前端代码的自定义
Categories: 博客记录
0 Responses so far.