简体   繁体   中英

set SelectedItem in DropDownList FLEX

I am making some simple project and I have problem with selectedItem. I have sth like this

<s:State name="Form" enterState="makesService.send()"/>

so when I enter this state I take makes from database and populate them to dropdownlist.

but I have also button and on click event I'm changing state to this Form and I want to select specific make from the dropdownlist but I can't. I'm not sure whether I'm doing sth wrong or the problem is that I'm selecting item just before the dropdownlist became populated.

ex List of make consist of Audi and BMW and when I click button I want to open this state Form in which this dropdownlist exist with selected value ex BMW.

How to make this the easiest way ?

Well from what I understand, first of all, when clicking the button and selecting the "Form" state you ought to check whether or not you have data that populates the dropdown item, so as not two make the call each time you enter this state.
The next this is to use the selectedIndex or selectedItem property of the dropdown list component.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM