0

I want to be selected that new Item in list when I give new value to dataProvider but it selects the item that was firstly selected, and how to make that selected permanently on App start up.

Arshad Ali
  • 3,082
  • 12
  • 56
  • 99

1 Answers1

0

You if want to select the list item after added to dataProvider. Probably you follow this

list.selectedIndex = list.dataProvider.length -1;

Sometimes if you added at desired position like

 list.dataProvider.setItemAt(obj,2); 

 list.selectedIndex = 2

If you want to selected item permanently on App start up.(Make sure that your array collections bind-able to list)

    public function onCreationComplete(event:FlexEvent):void
{
    callLater(function():void
    {
        list.selectedIndex = list.dataProvider.length -1;
        list.ensureIndexIsVisible(list.selectedIndex); // Viewport
    });
}
Raja Jaganathan
  • 33,099
  • 4
  • 30
  • 33