Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex: Custom Item Renderer For Combobox controls truncates text
    primarykey
    data
    text
    <p>I've implemented a custom item renderer that I'm using with a combobox on a flex project I'm working on. It displays and icon and some text for each item. The only problem is that when the text is long the width of the menu is not being adjusted properly and the text is being truncated when displayed. I've tried tweaking all of the obvious properties to alleviate this problem but have not had any success. Does anyone know how to make the combobox menu width scale appropriately to whatever data it's rendering?</p> <p>My custom item renderer implementation is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" styleName="plain" horizontalScrollPolicy="off"&gt; &lt;mx:Image source="{data.icon}" /&gt; &lt;mx:Label text="{data.label}" fontSize="11" fontWeight="bold" truncateToFit="false"/&gt; &lt;/mx:HBox&gt; </code></pre> <p>And my combobox uses it like so:</p> <pre><code> &lt;mx:ComboBox id="quicklinksMenu" change="quicklinkHandler(quicklinksMenu.selectedItem.data);" click="event.stopImmediatePropagation();" itemRenderer="renderers.QuickLinkItemRenderer" width="100%"/&gt; </code></pre> <p>EDIT: I should clarify on thing: I can set the dropdownWidth property on the combobox to some arbitrarily large value - this will make everything fit, but it will be too wide. Since the data being displayed in this combobox is generic, I want it to automatically size itself to the largest element in the dataprovider (the flex documentation says it will do this, but I have the feeling my custom item renderer is somehow breaking that behavior)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload