Form 3.0 and dhtmlxComboBox using Image

I try to use dhtmlxComboBox using dhtmlxForm 3.0, I use json initialisation.
I need to add image on combox item ( option) using optionType: “image” in the combo defintion :

window.dhx_globalImgPath = “./WspHtmlGui/style/imgs/”;

var formData = [

{type: “combo”, optionType: “image”, name: “combo2”, label: “Select Location”, position: “label-left”, labelWidth: 100, inputWidth: 100, options:[
{value: “1”, label: “Open”, selected:true},
{value: “2”, label: “Two”, img_src: “green.gif”}
]
},

var htmlForm16 = new dhtmlXForm(“htmlForm16”, formData);
var theCombo = htmlForm16.getCombo(“combo2”);

theCombo.setOptionHeight(40);
theCombo.setDefaultImage(“green.gif”);

Result :

I see the combo box in the Form, but no image

When I use the javascript debugger (Firebug) using mozilla browser , optionType equals to “default”, and not “image” as specifid in json format.

So that should I do to see icon image in combox item ?

Hello,

currently combo type doesn’t provide possibity to define options type. We’ll add this feature in the 3.0 Suite release. If you need this feature ASAP, let us know.

Hello Alexandra,

Thanks you for your reply.
I am currently developing a C++ framework to generate HTML Gui widgets dynamically using your javascript framework. I want to propose it in an open source project. The aim it to have a small footprint, faster web page dynamic generation, with secure execution. Seems we don’t need PHP platform.
Now I implement ComboBox in the Form 3.0 context release. I want to define dynamically icon for ComboBox item. It will be very interesting If this feature can be proposed. To have an idea of I want to propose, you can see the Qt framework API.

So what do you think about my request, and this project ?

Have a nice day Alexandra

Alexandra,

When to do plan to release the 3.0 suite ?
Do you have some documentation ?

Hello,

I want to define dynamically icon for ComboBox item

combo doesn’t provide public method to define an option image after the option is added.

The possible approach is:
combo.getOption(optionValue).content.firstChild.src = “some.gif”;

combo.getOption(optionValue) -is a public method to get option object.

When to do plan to release the 3.0 suite ?

in Early May

Thanks you for your answer Alexandra.

Have a nice Week-end.

I can not see the image. I build the comboBox object using json data throug a form 3.0 object. I don’t use the comboxBox constructor with “image” parameter for OptionType.

var formData = [
{type: “combo”, name: “combo2”, label: “Select Location”, position: “label-left”, labelWidth: 100, inputWidth: 100}];

var htmlForm16 = new dhtmlXForm(“htmlForm16”, formData);
var theCombo = htmlForm16.getCombo(“combo2”);
//theCombo.setDefaultImage("./WspHtmlGui/style/imgs/green.gif");

theCombo.addOption(“1”,“One”);
theCombo.addOption(“2”,“Two”);
theCombo.getOption(“1”).content.firstChild.src = “./WspHtmlGui/style/imgs/green.gif”;

So What is the matter ?

You can check sample at your dhtmlxForm package 02_items/08_combo.html:

window.dhx_globalImgPath = "../../../dhtmlxCombo/codebase/imgs/";

Form 3.0 doesn’t allows to define option type. The solution that I provided in the previous answer related to “dynamically icon for ComboBox item”.

Thanks you for replying Alexandra.
Have a nice week.