ConquistadorAravinth
ConquistadorAravinth

Reputation: 282

How to show a default selecteditem in a flex combobox

In a flex application how to display default selecteditem from the dataprovider of the combobox.

I'm using {staticdataholder.currencylist}.

For example: I have to show INDIA so it should be selected as default from the list.

Where INDIA is one of the value in the currencylist.

All suggestions are welcome.

Thank you.

Upvotes: 3

Views: 2279

Answers (2)

ConquistadorAravinth
ConquistadorAravinth

Reputation: 282

Hi guys i have found another solution for this..kindly checkout the same and its suits well like the above one..

create an ASUTil file where you have get convertmap and get value method keep th countrylist in static dataHolder.... currencycmb is the ID for the combobox....

then....keep the following in init method();

currencyCmb.selectedItem = ASUtil.getValue(StaticDataHolder.countryList,"SGD");

Hope This is great to Feed....:-)

Upvotes: -1

Matt MacLean
Matt MacLean

Reputation: 19648

You need to loop through your dataProvider and set the selected object:

Example:

for each ( var obj:Object in staticdataholder.currencylist ) {
    if ( obj == "INDIA" ) {
        cbx.selectedItem = obj;
        break;
    }
}

Upvotes: 3

Related Questions