EasyUI Forum
April 20, 2024, 02:15:21 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Questions about the combobox onselect event  (Read 13775 times)
adg456jljlx
Newbie
*
Posts: 6


View Profile
« 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?

Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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);
}
})
Logged
adg456jljlx
Newbie
*
Posts: 6


View Profile
« Reply #2 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 ?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!