简体   繁体   中英

Flex/AIR: DropDownList doesn't always open on click

I have an AIR application with 2-3 DropDownLists and a bunch of other controls. The DropDownLists are bound to dataproviders (ArrayCollections) in a central Model singleton. On launch, they all work fine.

However, when I click a button to add new objects to an object in another ArrayCollection in the same Model, the DropDownLists get weird. They still register clicks, and all other controls still work as before, but the dropdowns won't open. Clicking/waiting enough usually opens the dropdown, but if I don't make another selection it still won't open after closing. Making a different selection makes that DropDownList work again, but the others might still refuse to open.

If I open the dropdowns using Ctrl + Down arrow, they work all the time, so it's only the click that doesn't trigger the open correctly. I can work around the problem by calling openDropDown() on the dropdown when clicked, but that doesn't feel right.

I'm using the 4.1 SDK, and the dropdowns are s:DropDownLists. I tried using mx:ComboBoxes instead, but got the same behavior. Edit: Weirdly enough, using s:ComboBoxes they work as they should, but I really don't want to use them since they seemingly can't be made non-editable.

Has anyone run into this before and managed to solve it? Any suggestions are welcome.

After a whole lot of tinkering with this, it seems that the problem appears when I have a ToggleButtonBar which has its enabled attribute set based on an attribute in the presentation model I have for the view. The other controls handle

enabled="{model.certainObject != null}"

perfectly fine, but not the ToggleButtonBar. It sets the attribute as it should, but somehow seems to cause the dropdown problem I've been having. Guess I won't be using a ToggleButtonBar...=/

First thing to check: Are you ArrayCollections marked Bindable in your Model Singleton? Are your ArrayCollections bound to the values in the Model Singleton?

Binding is a strange beast; and if you are putting a lot of Bindable properties inside a single object; I understand that a change in one can trigger a chance in all bindable properties; which can ripple through the app if yu have a lot of different views all binding to that same Singleton object.

Another thing to check: I have seen really weird results if you use the same Collection as the dataProvider to multiple ComboBoxes. ( I assume the same odd behaviour would persist if using a multiple DropDownLists )

But, I'm just guessing here. Most likely something is off in yor code. Can you provide a runnable sample to demonstrate your problem?

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