Image in dhtmlxCombo not cleared when unselected

We are using a dhtmlxCombo with images, sometimes we need to reset the combo to an unselected option state and for that we consecutively call to these methods:



unSelectOption()

setComboValue(’’)

setComboText(’’)



The previously selected option becomes unselected but its image remains visible. What can we do to prevent that behavior and clear the image instead?


Hello,


try to use the following approach to unselect option:


combo.setComboValue("")
combo.DOMelem_image.style.visibility = ‘hidden’;



Yes, that did it! Also that works when we clear all combo options with combo.clearAll(true)

Thanks a lot!


Alexandra,

How can I clear the image using “combo.DOMelem_image.style.visibility = ‘hidden’;” when user has entered a value that is not in the combo options?

Right now, the last visible image will be visible, so my country flag for a specific flag will be visible even though the value is for example “Hohohooh”.

Thank you in advance!

You may try the onChange event:

combo.attachEvent("onChange",function(){ var text = this.getComboText(); if(!this.getOptionByLabel(text)) this.DOMelem_image.style.visibility = 'hidden'; });

Thank you Alexandra,

You might want to consider having this as an API function or similar in the future.
Or maybe even include it as default behavior.