dhtmlxCombo readonly style


I have created a combo with xml.
When the combo is set to readonly I want to change the style. But when this happens I get the result in the attachment.
I can’t see the whole text anymore, and the background of that part of the text is set, although the whole combo should have colored.

This is the part of the code where the style for the combo is set:

private static String STYLE_RO= “color: Gray; background-color:#efefef”;


child = xmlDom.createNode("element", "style", "");


Hope you can help me solving this problem.

Best regards

Please, make and attach completed demo to reproduce your issue and help you based on your sample
docs.dhtmlx.com/doku.php?id=othe … leted_demo

Creating a demo is very difficult because everything is loaded by XML and functions which are defined in different classes.

Do you have a demo where the style of the combo is set by XML?
Maybe I can find the problem myself then.

We have many samples, there combo is created via XML. But all of them such identical.
We suggest you to make demo ONLY with your combo, excepting of using any other components.
Because we need to see your principle of action of the combo.
Attach you some xml files of the combo
combo_xml.rar (2.93 KB)

Here is a demo

Best regards
Completed Demo combo style.rar (213 KB)

I can suggest you a littlebit another approach. It is simple, but why not. :slight_smile:
readOnly_color.rar (103 KB)

There is no color difference in your example between readonly true and false.
That’s the problem.

Locally it works fine. You can see on the picture which of the buttons is clicked and what statuses are active.

Where are you setting the colors in the code?
And you change the example is such way that it isn’t loading XML anymore.
I need to set the style attribute in XML, because the whole application is working like that. All DHTMLX components are working fine with the color change on read-only. Only the combo is having problems.

Sorry, i placed not correct demo…
Attach 2 new.

  1. Index.html is init form via js object and load only combo via xml
  2. Index2.html is init all the form via xml
    12.10.10.rar (101 KB)

Your example is working, but the style is not set by XML.
In this case I have to change over hundred .jsp files where combo’s are used.

In the example I gave you the whole combo including style was created in XML. This gives us a generic way to create a combo, so we have no need to change all our jsp files.

Isn’t there a posibility to set the background-color like this:


Form allows to define the “className” property for its items. This property is added to className of html element that reproduces Form item on a page. So, you can set a certain className for readonly “combo” item and define css rule that will be applied to Combo in such an item:

html page:

<style> .readonly_combo .dhx_combo_box, .readonly_combo .dhx_combo_input { color: gray; background-color:red; } </style>


<item type=“combo” className=“readonly_combo” readonly=“true” …>

Hi Alexandra

Could you send me a working example of that code.
In my code it’s not working.

Best regards


I have attached the working sample
demo.zip (53.4 KB)

Hi Alexandra

Thank you for the sample, it’s working now :slight_smile:

form.getCombo(‘foo’).DOMelem_input.style.backgroundColor = ‘’;