EasyUI Forum

General Category => General Discussion => Topic started by: adg456jljlx on February 07, 2017, 11:44:58 PM



Title: Questions about the combobox onselect event
Post by: adg456jljlx on February 07, 2017, 11:44:58 PM
the verson of easyui is 1.5.1

when I use the 'setText' method in the onSelect event of combobox, the value would be reset by anorther default event after the onSelect event.
For example.

$('#mycombobox').combobox({
        ....
   onSelect:function(record){
      $(this).combobox('setText','Hello World');
   }
});

'Hello World' will be replace by default event  in source code.

line 163 in jquery.combobox.js.

      if (!remainText){
         $(target).combo('setText', ss.join(opts.separator));
      }

How can I fix this bug?



Title: Re: Questions about the combobox onselect event
Post by: jarry on February 08, 2017, 02:23:01 AM
Please delay a little time to change its text.
Code:
$('#cc').combobox({
onSelect: function(row){
var target = this;
setTimeout(function(){
$(target).combobox('setText','Hello,World');
},0);
}
})


Title: Re: Questions about the combobox onselect event
Post by: adg456jljlx on February 08, 2017, 03:02:59 AM
Please delay a little time to change its text.
Code:
$('#cc').combobox({
onSelect: function(row){
var target = this;
setTimeout(function(){
$(target).combobox('setText','Hello,World');
},0);
}
})

Good! It can solve the problem, but is this a bug of easyui ?