dhtmlxCombo

Hello,

I have a problem with the dhtmlxCombo, I’m a beginner.



I load the combo with a XML, for example :

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



10

20

50

100





I load it in my page with this command :

var f=new dhtmlXCombo(“combo_page2”,“alfa2”,40);

f.loadXML(“data.xml”);



It loads the combo box but I am not having the first value selected. It starts with a blank element. I have a service that actually creates this xml and that service code I have some logic which I use to set one of the option as default selected but some times it is possible that no rule satisfies in the service and the selected=“1” will not get set for any option in this case I want the combo box to set the first element as the default.



Thanks

Joe


Hello,


you can use selectOption method to selectoption by index:


f.loadXML(“data.xml”,function(){


f.selectOption(0);


});