DHTMLX Docs & Samples Explorer

Index
dhtmlxcombo

## Adding Options

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);

- value - value of option
- label - label of option
- css - css string attached to option, optional

It is possible to add few options at once:

      var z=new dhtmlXCombo("combo_zone3","alfa3",200);
      z.addOption([[value,label,css],[value2,label2,css3],[value3,label3,css3]]);

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:

- value - option value
- selected - if option is selected
- img_src - icon url (also add the 4th parameter to combobox constructor - “image”)
- checked - checkbox state (for combo with “checkbox” type, 0 by default)

3. From autocomplete xml file

Plese check "filtration" section for more details

4. From HTML in case of converting from existing select box