1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > easyUI Combobox自定义调整支持中文模糊查询

easyUI Combobox自定义调整支持中文模糊查询

时间:2022-04-06 20:12:37

相关推荐

easyUI Combobox自定义调整支持中文模糊查询

1、调整Combobox支持模糊查询,并支持从任意位置开始匹配

解决方案:将字符串的indexof匹配由原来的判定为头部匹配,改为包含匹配

return row[opts.textField].toLowerCase().indexOf(q.toLowerCase())==0;

修改为 return row[opts.textField].toLowerCase().indexOf(q.toLowerCase())>-1;

我用的是eaysUI 1.4版本,修改代码在 jquery.easyui.min.js 中大概 12140 行左右。

2、调整Combobox,以支持搜索时中文输入结束不自动触发查询

解决方案:将触发查询执行的引起事件由keydown改成 keyup

$.bo.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:{click:_8a2,keydown:_8a6,paste:_8a6,drop:_8a6},panelWidth:null,panelHeight:200,panelMinWidth:null,panelMaxWidth:null,panelMinHeight:null,panelMaxHeight:null,panelAlign:"left",multiple:false,selectOnNavigation:true,separator:",",hasDownArrow:true,delay:200,keyHandler:{up:function(e){

},down:function(e){

},left:function(e){

},right:function(e){

},enter:function(e){

},query:function(q,e){

}},onShowPanel:function(){

},onHidePanel:function(){

},onChange:function(_8d6,_8d7){

}});

修改为

$.bo.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:{click:_8a2,keyup:_8a6,paste:_8a6,drop:_8a6},panelWidth:null,panelHeight:200,panelMinWidth:null,panelMaxWidth:null,panelMinHeight:null,panelMaxHeight:null,panelAlign:"left",multiple:false,selectOnNavigation:true,separator:",",hasDownArrow:true,delay:200,keyHandler:{up:function(e){

},down:function(e){

},left:function(e){

},right:function(e){

},enter:function(e){

},query:function(q,e){

}},onShowPanel:function(){

},onHidePanel:function(){

},onChange:function(_8d6,_8d7){

}});

我用的是eaysUI 1.4版本,修改代码在 jquery.easyui.min.js 中大概 11723 行左右。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。