Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Jul 02, 2009 09:26
open dhtmlx forum
combobox set checked

How come setChecked for combo box does not support "unsure" as second paramter in case we want it to automatically check if its already checked, and if so uncheck it.

Answer posted by Alex (support) on Jul 06, 2009 00:22

You can use getChecked() method that returns array with values of checked options. So, you can define if  option is checked or not.

var state = true;
var index = combo.getIndexByValue(value);
var checked = combo.getChecked();

for(var i = 0 ; i < checked.length;i++)
 if(checked[i]==value) state = false;

combo.setChecked(index,state);

Answer posted on Aug 31, 2009 07:27
We suggest adding the "unsure" parameter.  Makes this much easier and consistent with your other API calls.
Answer posted by Alex (support) on Aug 31, 2009 09:48

Thank you for the suggestion.

Possibly we'll this feature in one of the next releases. But currently we don't have plans to add it.