I wish to create a ComboBox with ItemRenderers that can have multiple lines (or not). An image says more than a thousand words, so here goes:
And this is the very simple code that goes with it:
<s:ComboBox>
<s:layout>
<s:VerticalLayout gap="0" requestedMinRowCount="1" requestedMaxRowCount="6"
horizontalAlign="justify" variableRowHeight="true" />
</s:layout>
</s:ComboBox>
Now the problem is that every once in a while, when the dataProvider is really big and some of the labels are pretty long, the ComboBox goes completely berzerk. Sometimes the popup flickers and disappears never to return. Sometimes I can see the popup, but it's not in the correct place (which is right below the TextInput) and it displays way too many items (if you look at my code, you'll see that I set requestedMaxRowCount="6"
).
This looks a lot like a bug in the component or the layout class. I don't think this is an extremely uncommon use case though, so I'm hoping someone out there has already found a viable workaround for this issue.
Note that setting a fixed width on the ItemRenderer and using horizontalAlign="contentJustify"
is not an acceptable option. The solution must be reusable and I don't want to create a custom ItemRenderer for each and every ComboBox in an application. (Also the custom theme used in the picture is not the issue; I've tested with the default Spark theme too).