| DHTMLX Documentation

# Managing select box collection (co, coro excells)

The following method can be used to get a select box collection common for the whole column:

> combo = grid.getCombo(index);

If you need a collection to be specific for a cell:

> combo = grid.getCustomCombo(rowId,cIndex)

The collection supports the following API:
combo.put(value,label) - adds a new record in the collection;
combo.remove(value) - removes a record from the collection;
combo.clear() - removes all records from the collection;
combo.size() - returns the current size of the combo box;
combo.get(value) - returns the label by value;
combo.getKeys() - returns the array of all possible values;
combo.save() - saves the current state;
combo.restore() - restores the previously saved state.
The less common use-case is the one that gets the value by the label. This can be done using the following code:

> var value = combo.values[combo.keys._dhx_find(key)];

### Initialization from XML

The list of options for combo can be defined from XML in two ways:
a) With column configuration the values will be set for all cells in a column
<rows>
<head>
<column type="co"> Combo column
<option value="1"> First </option>
<option value="2"> Second </option>
<option value="3"> Third </option>
</column>
b) For separate cells ( pro version only )
<rows>
<row id="some1">
<cell> some </cell>
<cell> some </cell>
<cell xmlcontent="true">1<option value="1">The first</option><option value="2">The second</option></cell>
<cell> some </cell>
</row>
</rows>
© DHTMLX, 2008