How can I add an style for optgroup in the dhtmlxcombo.css?

I am using an XML file to load the options for the combo, it works well but I’d like to apply an style to the options to make them more easy to read because there are cities and places that could be visually grouped by state by instance. A sample of the resultant XML is:

[code]<?xml version="1.0" encoding="iso-8859-1"?>

Campeche Campeche - Campeche Xpuhil - Campeche Uayamon - Campeche Chiapas Chiapa de Corzo - Chiapas Comitán - Chiapas La Trinitaria - Chiapas Tapachula - Chiapas Palenque - Chiapas San Cristobal de las Casas - Chiapas Tuxtla Gutierrez - Chiapas Yucatan Abala - Yucatan Celestun - Yucatan Merida Tixkokob - Yucatan Telchac Puerto - Yucatan Uxmal - Yucatan Valladolid - Yucatan Uxmal - Maxcanu - Yucatan Chichen Itza [/code]

What I want to do is apply a style for the optgroup to make a visual contrast between options for instance, something like:

optgroup { background-color: black; color: white; } option { background-color: white; color: black; }

With that it would be easier to read the options but I don’t know how to do it through the dhtmlxcombo.css file, I am using the “skyblue” skin.

I’d appreciate your help and suggestions. Thanks in advance.



combo doesn’t not support optgroup. You may place html as the option label:


However, all options can be selected and highlighted. And if you are using filtering, the option with group name will be also considered.

Thank you Alexandra,

It doesn’t work as I’d like it but at least is a way to have some style for the grouped options.

It would be nice that in a new version the combo could handle the ‘optgroup’.

Thanks again.



currently we do not have plans to add this feature. But we will consider this idea and possibly add it in one of the future releases.