EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Jeffrey AnnSheila on May 20, 2016, 02:45:00 AM



Title: how to make the autocomplete of combox response for chinese words comfortably
Post by: Jeffrey AnnSheila on May 20, 2016, 02:45:00 AM
hi, i find the autocomplete of combox works fine for english inputting, but when i enter a chinese word , it doesn't show the suggest list until i click the "Ctrl" ,"Command“or "Shift" again. that is a trifle disappointing. i need help to improve it.


Title: Re: how to make the autocomplete of combox response for chinese words comfortably
Post by: stworthy on May 21, 2016, 03:08:11 AM
Please try to add this code to your page.
Code:
<script type="text/javascript">
(function($){
function inputEventHandler(e){
var target = e.data.target;
var t = $(target);
var state = t.data('combo');
var opts = t.combo('options');
if (opts.editable){
if (state.timer){
clearTimeout(state.timer);
}
state.timer = setTimeout(function(){
var q = t.combo('getText');
if (state.previousText != q){
state.previousText = q;
t.combo('showPanel');
opts.keyHandler.query.call(target, q, e);
t.combo('validate');
}
}, opts.delay);
}
}
$.extend($.fn.combo.defaults.inputEvents, {
input: inputEventHandler
});
})(jQuery);
</script>