Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by dileep on Sep 22, 2009 06:18
open dhtmlx forum
how to access multiple attribute values from combo option

hi,
I have an xml returned by jsp as shown below.

<complete>
<option value="758" id="NEW One">NEW One</option>
<option value="749" id="Test all">test all</option>
<option value="750" id="Test all 1">Test all 1</option>
<option value="751" id="Test all 2">Test all 2</option>
<option value="759" id="NEW One2">NEW One2</option>
<option value="754" id="Test all 5">Test all 5</option>
<option value="752" id="Test all 8">Test all 8</option>
</compete>
so i want to access both value and id.
i.e, both 749 and New One
i used getSelectedValue() method but its only returning 749.
Thanks in advance.
Answer posted by Alex (support) on Sep 22, 2009 09:39

Hello,

combo doesn't support additional attributes.

But it's possible to add attribute directly in the dhtmlxcombo.js. Try to locate here teh following method and add teh necessary attribute:

dhtmlXCombo_defaultOption.prototype.setValue = function(attr){
  this.value = attr.value||"";
  this.text = attr.text||"";
  this.css = attr.css||"";
  this.content=null;
 this.id = attr.id||"";
}

and this attribute can be got by var id= combo.getOption(value).id method