Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by aa on Aug 19, 2008 23:54
open dhtmlx forum
why dhtmlcombo don't have "setSelected" mehtod

I write a method to select a item,why dhtmlcombo don't have "setSelected" mehtod?

// myself setSelect(value);
dhtmlXCombo.prototype.setSelect = function(val){
     var v_text;
     if(val==null || val == "" || val=="null"){
     this._selOption = null;
         this.setComboValue(null);
     this.setComboText("");    
     }else{
     for(var i=0; i<this.optionsArr.length; i++)
     if(this.optionsArr[i].value == val) {
             v_text = this.optionsArr[i].text;
                this._selOption = this.optionsArr[i];
                this.setComboValue(val);    
                this.setComboText(v_text);              
              }
     }
}
Answer posted by Support on Aug 20, 2008 02:57
Combo has

a) combo.selectOption(index) to select option by index
b) combo.setComboValue(value) to select option by value

There was a error in older version, when setComboValue not selected related option - it is fixed in latest version. 
Answer posted on Aug 20, 2008 08:14
thank you !  I will download the last version and  try setComboValue.