Flex 3.5.0; Update ComboBox display list upon dataprovider change

comboboxdataproviderdisplaylistflex3

I have two related ComboBoxes ( continents, and countries ). When the continents ComboBox changes I request a XML from a certain URL. When I receive that XML i change the DataProvider for the countries ComboBox, like this:

public function displayCountryArray( items:XMLList ):void
        {
            this.resellersCountryLoader.alpha = 0;
            this.resellersCountry.dataProvider = items;
            this.resellersCountry.dispatchEvent( new ListEvent( ListEvent.CHANGE ) );
        }

I dispatch the ListEvent.CHANGE because I use it to change another ComboBox so please ignore that (and the 1st line ).

So, my problem is this: I select "ASIA" from the first continents, then the combobox DATA get's updated ( I can see that because the first ITEM is an item with the label '23 countries' ). I click the combo then I can see the countries.

NOW, I select "Africa", the first item is displayed, with the ComboBox being closed, then when I click it, the countries are still the ones from Asia. Anyway, if I click an Item in the list, then the list updates correctly, and also, it has the correct info ( as I said it affects other ComboBoxes ). SO the only problem is that the display list does not get updated.

In this function I tried these approaches

  • Converting XMLList to XMLCollection and even ArrayCollection

  • Adding this.resellersCountry.invalidateDisplayList();

  • Triggering events like DATA_CHANGE and UPDATE_COMPLETE
    I know they don't make much sense, but I got a little desperate.

Please note that when I used 3.0.0 SDK this did not happen.

Sorry if I'm stupid, but the flex events are killing me.

Best Answer

Setting the dataprovider of the comboBox' dropdown seems to fix this problem.

this.resellersCountry.dataProvider = items;
this.resellersCountry.dropdown.dataProvider = items;
Related Topic