Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dennis on Jan 15, 2008 11:53
open dhtmlx forum
Similar problem with combo width

Hello,

I've run into a similar problem with the combo width in filtering mode. I have white-space:nowrap set for .dhx_combo_list in the CSS and combo.autoOptionSize=true; for the combo box.
As I'm typing into the filter text box, the div that gets returned is set to a little bit wider than the combo input textbox. I have to leave focus of the textbox and come back in order for the div to resize itself. Is there a way to resize that div as the filter receives xml from the server?

Thanks for the help,

Dennis
Answer posted by Support on Jan 16, 2008 07:38
There is no API in existing component ( it will be probably added in to next build ), so for now custom code is the only way to achieve such effect
You can add next code

var updater = function(){   //this code resize option list to max option width
            var x=this.DOMlist.offsetWidth;
            for ( var i=0; i<this.optionsArr.length; i++)
                if (this.DOMlist.childNodes[i].scrollWidth > x)
                    x=this.DOMlist.childNodes[i].scrollWidth;
                   
            this.DOMlist.style.width=x+"px";
}

combo.attachEvent("onKeyPressed",updater);
combo.attachEvent("onSelectionChange",updater);