Note that there are some explanatory texts on larger screens.

plurals
  1. POSet selectedItem on a Flex Combobox when the Combobox is not displayed?
    text
    copied!<p>I am trying to set selectedItem on a comboBox(mx). Following is the code :</p> <pre><code>callLater(function ():void { if (comboBox.dataProvider &amp;&amp; comboBox.dataProvider.length &gt; 0) { comboBox.selectedItem = comboBox.dataProvider.getItemAt(0); } }); </code></pre> <p>EDIT : I am creating Comboboxes programatically : </p> <pre><code>var comboBox:ComboBox = new ComboBox(); </code></pre> <p>This works fine and sets the selectedItem to the first item from the data provider - <strong>but ONLY if the combobox is displayed on the screen and not hidden within a collapsible group</strong>.</p> <p>I have a situation where I may have the combobox enclosed within a Collapsible Group (my own component) and not displayed until the collapsed group is expanded (see images below)</p> <p>First Image : When the groups are collapsed and combobox is not displayed but created <img src="https://i.imgur.com/g6RI0.png" alt="collapsed_groups"></p> <p>Second Image : when the collapsed group is expanded to display the combobox - notice that the first element in the dataprovider is NOT selected as selectedItem</p> <p><img src="https://i.imgur.com/8Dg5l.png" alt="Expanded Group"></p> <p>following line is ALWAYS executed</p> <pre><code> comboBox.selectedItem = comboBox.dataProvider.getItemAt(0); </code></pre> <p>But the first item is not selected in the case when the combobox is enclosed in a collapsed group - works fine when the combobox is enclosed in an expanded group.</p> <p>I think this is a bug in flex - unless someone thinks otherwise ?</p>
 

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