views:

14

answers:

1

I have a spark list, which is based on a dataProvider. As the application runs, the data in the dataprovider can change, and also the dataProvider can be swapped for a different one

What I need to do is make sure that something is always selected in the list (unless it is empty)

A: 

After setting its data provider ( or whenever is changed ) you could do a:

myList.selectedIndex = 0;

, so whenever the is data on your list, its first item will be selected (it could be any index, just remember that it start from 0 to length - 1).

falomir