Options can be added in the next ways:
1. By addOption command:
var z=new dhtmlXCombo("combo_zone3","alfa3",200); z.addOption(value,label,css,img_src);
It is possible to add few options at once:
var z=new dhtmlXCombo("combo_zone3","alfa3",200); z.addOption([ ["a","option A"], ["b","option B", "color:red;"], ["c","option C"] ]);
var z=new dhtmlXCombo("combo_zone3","alfa3",200); z.addOption([ {value: "a", text: "option A", img_src: "../images/blue.gif", css:"color:red;"}, {value: "b", text: "option B", img_src: "../images/green.gif"}, {value: "c", text: "option C", img_src: "../images/red.gif"} ]);
2. From XML file:
var z=new dhtmlXCombo("combo_zone3","alfa3",200); z.loadXML("xml/data.xml");
Where XML has the following format:
<?xml version="1.0" ?> <complete> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> <option value="4">four</option> <option value="5">five</option> <option value="6">six</option> <option value="7">seven</option> <option value="8">eight</option> <option value="9">nine</option> <option value="10">ten</option> </complete>
Possible attributes of <option> tag are as follows:
3. From autocomplete xml file
Plese check "filtration" section for more details
4. From HTML in case of converting from existing select box