Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by couetbis on Apr 07, 2008 01:14
open dhtmlx forum
DhtmlxCombo : reset input on onclick

Hi,
I use combo with filtering mode. When user type data in combo, data are filtered. But when user click on combo, I want see all options of combo and no just his selection. A idea is to reset input when user click on combo.
The question : how to add event onClick on combo ? Have you got another idea ?
Thanks
Answer posted by Support on Apr 07, 2008 05:46
Can be done with indirect code modifications
    var combo = new dhtmlXCombo(....
    combo._toggleSelectA=combo._toggleSelect;
    combo._toggleSelect=function(){
       combo.setComboText("");
       combo.filterSelf();
       combo._toggleSelect.apply(this, arguments);
    }
Answer posted on Apr 07, 2008 11:43

Answer posted on Apr 07, 2008 11:44
I'm trying to do the same thing, but that code does not work for me. Here is the code on my page:

<script>var z=dhtmlXComboFromSelect("combo_zone1");
z.enableFilteringMode(true);
z.enableOptionAutoHeight(1);
</script>

How can I change it?

Thanks.
Answer posted by couetbis on Apr 08, 2008 00:41
Thanks for your response.
I redefine _toggleSelect function, I add 2 instructions.

         dhtmlXCombo.prototype._toggleSelect = function(e)
         {
            var that=this.combo;
            if ( that.DOMlist.style.display == "block" ) {
            that.closeAll();
            } else {
               that.openSelect();
               that.setComboText("");
               that.filterSelf();
            }
            (e||event).cancelBubble = true;
         }

It's work, thanks !