EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Fabrice on September 17, 2014, 05:54:44 AM



Title: propertygrid and combobox
Post by: Fabrice on September 17, 2014, 05:54:44 AM
I have a combobox item in a propertygrid with list of items and possibility of enter new string.
when i select an element in combobox all is ok
when i enter a new string and then press enter, field become empty, but if i click on another field, all is ok

can you help me to keep new string when press enter?



Title: Re: propertygrid and combobox
Post by: stworthy on September 17, 2014, 06:36:58 PM
Please try to override the keyHandler.enter function for your combobox editor.
Code:
"editor":{
"type":"combobox",
"options":{
//...
keyHandler:$.extend(true,{},$.fn.combobox.defaults.keyHandler,{
enter:function(e){
var s = $(this).combobox('getText');
$.fn.combobox.defaults.keyHandler.enter.call(this,e);
if (!$(this).combobox('getText')){
$(this).combobox('setValue', s);
}
}
})
}
}


Title: Re: propertygrid and combobox
Post by: Fabrice on September 18, 2014, 06:43:19 AM
you are definitely the best, I added the following lines:

Code:
setTimeout(function () {
    $(document).trigger('mousedown');
}, 0);
to endEdit when enter is pressed