简体   繁体   English

Flex组合框需要选择两次才能打开下拉列表

[英]Flex combobox needs to be selected twice to open drop down list

When a combobox is elected in the flex app, there is a quick flicker, then the combobox needs to be selected again in order to get the dropdown to open. 在Flex应用程序中选择组合框时,会快速闪烁,然后需要再次选择组合框才能打开下拉列表。 After that, the dropdown works as expected, but only while selecting the control subsequent times while on the form. 此后,下拉菜单将按预期工作,但仅在随后在窗体上选择控件时才起作用。 Reloading the form requires the double selection again. 重新加载表格需要再次选择两次。 Any insights to how to clear this up would be very much appreciated. 对于如何解决此问题的任何见解将不胜感激。

The way I had to get around this issue was my creating a custom component that extends the ComboBox control that will set the ComboBox's List dataProvider at the same time as the ComboBox's dataProvider . 我必须解决的方法是创建一个自定义组件,该组件扩展了ComboBox控件,该控件将同时设置ComboBox的List dataProvider和ComboBox的dataProvider

ComboBoxFix.as ComboBoxFix.as

package
{
    import mx.controls.ComboBox;

    public class ComboBoxFix extends ComboBox
    {
        public function ComboBoxFix()
        {
            super();
        }

        override public function set dataProvider(value:Object):void 
        {
            super.dataProvider=value;

            if(dropdown != null)
            {
                super.dropdown.dataProvider=value;
            }
        }

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number ):void 
        {
            super.updateDisplayList (unscaledWidth, unscaledHeight);
            if (dropdown != null)
            {   
                dropdown.width = unscaledWidth; 
            }
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM