Check documentation for the latest version of dhtmlxSuite Select/Combo-box Columns in Grid DHTMLX Docs

Select/Combo-box Columns in Grid

When a grid has 'co'/'coro' columns ( select/combo-box ), it will automatically request data for them in the same manner as for Filtering options. So it's possible to use a similar way of logic to define which list of values needs to be used in select/combo inside of the grid.

  • an automatic list - if no custom instruction is provided , the grid will use DISTINCT select for the related field, and fetch all the possible options

  • a hardcoded list

connector.ExplicitOptions.Add(
    connector.Request.RequestedFields[0], 
    "Alpha", 
    "Beta", 
    "Gamma"
);
//or
connector.ExplicitOptions.Add((TableField)"FieldName", "Alpha", "Beta", "Gamma");

The example above will add 3 options ("Alpha", "Beta", "Gamma") to the filter associated with the first column.

  • a list created on the base of different tables
dhtmlxOptionsConnector filterConnector = new dhtmlxOptionsConnector(
    "Country", 
    "ISO", 
    connector.Request.Adapter
);
//attach a filter connector to the first column of grid connector
gridConnector.OptionsConnectors.Add(
connector.Request.RequestedFields[0], 
filterConnector
);

First of all, we create dhtmlxOptionsConnector to fetch items, specify a table and a field name to take options title from, and then provide a database adapter (Request.Adapter) already created for gridConnector.

Finally, we add the options connector to the first field of gridConnector.

Back to top