Check documentation for the latest version of dhtmlxSuite Managing Select Box Collection DHTMLX Docs

Managing Select Box Collection

The functionality described below is applicable to co, coro column types.

Initialization by script

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

combo = grid.getCombo(index);

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

combo = grid.getCustomCombo(rId,cIndex)

The collection supports the following API:

combo.put(value,label); // adds a new record to 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

Initialization from XML

The list of options for combo can be defined from XML in two ways:

  • 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>
  • 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>
Back to top