Adding Default Value to a combo

Hi All,

I want to add a default value to a combo.

Example: -
While inserting a row, i want to set default value ‘10’ into combo.
that means i want to select option ‘10’ in a combo.
let the combo contains ‘10’, ‘20’, ‘30’ as a options.

gridObj.setColTypes(“txt,combo”);

gridObj.addRow(rowId, [‘hi’, ‘10’]);

But if the default value is ‘40’.
i don’t want to select ‘40’ in a combo.
because ‘40’ is not there in the options.

That means i want to check the default value ‘40’ is present in the combo or not before adding a new row.

Thanks,
Abhi

We cannot see any troubles in adding a row with specified value.
If you have any issues please couldn’t you be more specific

Hi,

i have no problem with adding the default value.

my issue is that, i want to check a value is present in a combo or not.
if value is present then only i will set default value to that combo field
other wise i will not set the default value.

example:
let column ‘A’ is a combo type.
combo’s option are

1 2 3 i want to check option 2 is present in the combo's option or not.

Thanks,
Abhi

In this case you may try to use getIndexByValue() method.
http://docs.dhtmlx.com/doku.php?id=dhtmlxcombo:api_method_dhtmlxcombo_getindexbyvalue

If the there is no item with needed value, method returns “-1”.