Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Sergio on Oct 18, 2008 04:06
open dhtmlx forum
How to put images in the combobox and enable autocomplete?

How to put images in the combobox and enable autocomplete?


I have this sample code:
Images and files are in the dhtmlx folder.

<html>
<head>

<script type="text/javascript">
    window.dhx_globalImgPath="dhtmlx/";
</script>
<link rel="STYLESHEET" type="text/css" href="dhtmlx/dhtmlxcombo.css">
<script type="text/javascript" src="dhtmlx/dhtmlxcommon.js"></script>
<script type="text/javascript" src="dhtmlx/dhtmlxcombo.js"></script>
<script type="text/javascript" src="dhtmlx/dhtmlxcombo_extra.js"></script>

</head>
    

<body>


<select style='width:200px;' id="zone1" name="alfa1">
        <option value="0"></option>
<option value="1" img_src="dhtmlx/book.gif" >a00</option>
<option value="2">a01</option>
<option value="3">a02</option>
<option value="4">a10</option>
<option value="5">a11</option>
<option value="6">a12</option>
<option value="7">b00</option>
<option value="8">b01</option>
<option value="9">b02</option>
<option value="10">b10</option>
<option value="11">b11</option>
</select>


<script type="text/javascript">
    var z=new dhtmlXCombo("zone1","alfa1",200, 'image');
    //var z=dhtmlXComboFromSelect("zone1",200);
    z.setDefaultImage("book.gif");
    z.enableFilteringMode(true);
</script>


</body>
</html>


I do I make it work?
Answer posted by Support on Oct 20, 2008 01:51
<select style='width:200px;' id="zone1" name="alfa1" opt_type="image">
 ....
<script type="text/javascript"> 
  var z=dhtmlXComboFromSelect("zone1",200); 
  z.setDefaultImage("book.gif"); 
  z.enableFilteringMode(true); 
</script>