views:

36

answers:

2

Hi,

I had a comboBox and loading the datadynamically from the server. i need to display the first value in comboBox as a selected value and based on the value data should be populated on the grid. Please send me a sample example on the same if nay one knows.

thanks, Ravi

+1  A: 

You can select the first value by setting: selectedIndex=0 or set the selectedItemproperty.

But you should make sure that there is an item which you can select. This could be for example done in the setter of the dataProvider.

hering
how to add selectedItem property in combobox?
Ravi K Chowdary
`<s:ComboBox selectedItem="{mySelectedItem}" />` the syntax is the same as in the halo components: `<mx:ComboBox selectedItem="{mySelectedItem}" />`
hering
A: 

Another way to make sure that you have data is add a ChangeWatcher to the dataProvider, so that you will be notified when new data is bound. Then you can simply traverse the data and select whichever one you want, in your case selectedIndex=0;

Martin