Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jakim on Nov 29, 2008 15:10
open dhtmlx forum
How to enable checkbox and images on combobox?

Hi,


How can we enable checkboxes AND images on a combobox?

here I can only set opt_type for 'image' or 'checkbox'...

<select style='width:220px;' id="zone1" name="alfa1" opt_type="image" >
        <option value="0"></option>
<option value="1" img_src="dhtmlx/book.gif" >a00</option>
<option value="2" img_src="dhtmlx/ico_xls_18.gif">a01</option>
<option value="3">a02</option>
<option value="4">a10</option>
<option value="5">a11</option>
</select>


<script type="text/javascript">
    var z=dhtmlXComboFromSelect("zone1",100);
    z.enableFilteringMode(true);
    z.setOptionHeight('18px');
    zattachEvent('onChange', set);
</script>

thank you
Answer posted by Support on Dec 01, 2008 02:03
The option may have checkbox OR image , it can't use both. Also it not possible to mix different type of options in same combo ( all options must have the same type )
Answer posted by Jakim on Dec 04, 2008 14:36

Thanks for your reply.

Would be nice to have both checkbox and image available for one combobox. But its possible to include some more javascript code to enable this geature right?

Also have another question: How do I atach a function to the checkboxes to be called on checkbox change?

thanks

Answer posted by Jakim on Dec 04, 2008 15:35

also sending arguments to the z.attachEvent('onChange', set_it(var) ); doesnt work. Is it possible to acomplish this some other way? 

thanks



Answer posted by Support on Dec 05, 2008 02:04
>>But its possible to include some more javascript code to enable this geature right?
Each type of option is a separate object, so in theory it possible to create any kind of option, by creating new type of such object, but it will require significent amout of coding. 

>>: How do I atach a function to the checkboxes to be called on checkbox change?
There is no special event for such operation, but combo has a method combo.getChecked() which returns list of currently checked items.

>>also sending arguments to the z.attachEvent('onChange', set_it(var) ); doesnt work
The second argument of onChange must be a function object
              z.attachEvent('onChange', set_it);
If you need to provide some additional param it can be done as
     var param="some";
     z.attachEvent("onChange",function(){
                 set_it(param);
     });