Check documentation for the latest version of dhtmlxSuite Select/Combobox Columns in Grid DHTMLX Docs

Select/Combobox Columns in Grid

When on the client side you specify co/coro/combo columns (combo-box/select) in a grid, the grid will automatically request data for them in the same manner as for the filtering options.

Grid will use the DISTINCT select against the related field by default, and fetch all possible options.

If you need to define a custom list of options you can use one of 2 ways:

  • a hardcoded list
//value=>label
$grid->set_options("item_nm",array("1"=> "one", "2"=>"two","3"=> "three")); 
$grid->render_table("grid50","item_id","item_nm,item_cd");
  • a list created on the base of a different table
$options = new OptionsConnector($res,"MySQL");
$options->render_table("countries","country_id","country_id(value),country_name(label)");
//or $options->render_sql("Select country_id as value,country_name as 
//label from countries","country_id","country_id(value),country_name(label)");
 
$grid->set_options("item_nm",$options);
 
$grid->render_table("grid50","item_id","item_nm,item_cd");

co/combo type

  • when using a predefined list of data, both values and labels need to be provided
  • when using a connector, there must be two fields selected, one as (value), the second one as (label)

coro type:

  • only labels need to be provided
  • a connector may define only the label parameter
Back to top