jQuery EasyUI 1.4.4 Combobox无法检索中文输入的问题

   在项目里使用了EasyUI的Combobox,当ComboBox的item是英文时,都能正常检索出对应项,但是如果使用中文输入法输入几个字母然后通过按shift键输入时,奇怪的事情发生了,combobox无法检索出正确的值.

 
我们用的easyui版本是1.4.4
 
需要修改jquery.easyui.min.js  给combobox控件添加了一个input事件绑定:
 
在源码的12424行:if(opts.editable){ 在这个方法体}之前,加入代码:
 1 /**解决jQuery EasyUI Combo以及其继承者无法检索中文输入的问题**/
 2 var _85b = t.combo("textbox");
 3 _85b.bind("input",function(e){
 4                 if(_96e.timer){
 5                     clearTimeout(_96e.timer);
 6                 }
 7                 _96e.timer=setTimeout(function(){
 8                     var q=_85b.val();
 9                     if(_96e.previousValue != q){
10                         _96e.previousValue = q;
11                         //_672(_66c);
12                         t.combo("showPanel");
13                         opts.keyHandler.query.call(_96d, _85b.val(),e);
14                         t.combo("validate");
15                         // _67b(_96d, true);
16                     }
17                 },opts.delay);
18             });
19 /**end**/ 
其中各个变量的含义如下:
var _96e=t.data("combo");
var _96d=e.data.target;
var _85b = t.combo("textbox");//不能写成t.textbox
 
原理很简单,对combox的textbox父类添加bind事件。
 
 
===============================================================
顺便提一下在easyui 1.3.6版本中 jquery.easyui.min.js 11129行加入添加代码:
/******************/
_85b.bind("input",function(e){
if(_858.timer){
clearTimeout(_858.timer);
}
_858.timer=setTimeout(function(){
var q=_85b.val();
if(_858.previousValue!=q){
_858.previousValue=q;
$(_857).combo("showPanel");
opts.keyHandler.query.call(_857,_85b.val(),e);
$(_857).combo("validate");
}
},opts.delay);
/***********************/

 

 
posted @ 2016-03-31 15:18  NormanTian  阅读(944)  评论(0编辑  收藏  举报