Dhtmlx Combo

Hello again,



I`m working on PRO version of Dhtmlx.

I have a dhtmlXCombo with “n” options and I want each option to store apart from the value="" and text, extra attributes, for example:





    TEST 1

    TEST 2

    TEST 3





Is there a way to do this and the retrieve this values?



Thanks a lot

Andres


Hello,


there is no public method to add additional attributes to the option. But custom solution is possible.


For example, if you want to add “code” attribute, the dhtmlxcombo.js should be modified as follows:


try to locate dhtmlXCombo_defaultOption.prototype.setValue = function(attr){ line and add here the highlighted line:


dhtmlXCombo_defaultOption.prototype.setValue = function(attr){
this.value = attr.value||"";
this.text = attr.text||"";
this.css = attr.css||"";
this.content=null;
this.code = attr.code||"";
}
To get code value you can use var combo = combo.getOption(optionValue).code approach.



Thanks a lot Alex!
It worked perfect.