Display combo as dropdown/select without double click


#1

Hi,

I want to display the combo box in the grid cell as we see an html select control. It should always show as dropdown and not just when the cell is double clicked.
For example in https://dhtmlx.com/docs/products/dhtmlxGrid/samples/13_interaction_other_components/01_pro_combo.html I want the Selectbox Mode to always show as value in a select control instead of just the value.
Is it possible to achieve this?

Also, when I double click in my grid it allows me to enter text in the cell. I just want it to allow selecting one of existing options. In my grid I have

mygrid.setEditable(true);

as without this, the combo never shows even if double clicked.
Note that I am using
Version: 5.0.2
Edition: Professional

I do the column type etch setting in the script instead of XML and options in combo are loaded using following code within the grid loading script:
for (i = 0; i < contryArray.length; i++) {
mygrid.getCombo(14).put(contryArray[i], contryArray[i]);
}

This is also causing the combo to not load the selected value that is passed for the column in the XML.

Regards,
Nilesh


#2

Please, try to use the “ro” column type in your case.
But the better solution is tio create your own custom column type.
Here you can find a tutorial with some examples:
https://docs.dhtmlx.com/grid__columns_types.html#customcolumntypes


#3

Hi @sematik,

Thanks for the suggestion.
When I use “ro” as column type, the dropdown never appears and the cell becomes un-clickable. So this doesn’t work. I will look into the custome columnt type option, but would prefer to get it working with combo or any grids default supported types.
The two issues I am facing with column type combo is:

  1. It allows me to enter text that is not part of the options. How to avoid this.
  2. It doesn’t show the selected value in the cell, it shows blank. How to get the selected value to show.

Regards,
Nilesh


#4

Please, try to use the “combo_v” column type instead of the “combo”.


#5

Yes, this adds the dropdown icon to the cell. Thanks @sematik