简体   繁体   中英

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. 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 .

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; 
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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