Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stan on Jul 20, 2009 15:10
open dhtmlx forum
dhtmlXCombo add Option with images

Hi,

How to add options (like this syntax)
var z=new dhtmlXCombo("combo_zone3","alfa3",200);
z.addOption([[1,1111],[2,2222],[3,3333],[4,4444],[5,5555]]);

that contain image ?

Currently, I use an external xml file like this one
<?xml version="1.0" ?>
<complete>
<option value="1" img_src="m/img/google.gif">Google</option>
<option value="2" img_src="m/img/yahoo.gif">Yahoo</option>
<option value="3" selected="selected" img_src="m/img/bing.gif">Bing</option>
<option value="4" img_src="m/img/wikipedia.gif">Wikipedia</option>
</complete>

I don't know which syntax to use for adding the img_src and the "selected" attribute...

Any help ???

Stan


Answer posted by Alex (support) on Jul 21, 2009 01:02

Hello,

the values should use the associative array. For example as follows:

combo.addOption([{"value":1,"text":"1111","img_src":"../images/someimage1.gif"},{"value":2,"text":"2222","img_src":"../images/someimage2.gif"},...]);