Scroll to selected item in Flex 4 Spark List component

前端 未结 12 1529
感动是毒
感动是毒 2020-12-15 17:46

I\'m setting selected element in s:List component with Actionscript, it works, but List doesn\'t scroll to selected item -- need to scroll with scrollbar or mouse. Is it pos

12条回答
  •  感情败类
    2020-12-15 17:54

    This worked for me. had to use the callLater.

    list.selectedItem = "MyTestItem"; //or list.selectedIndex = 10;
    this.callLater(updateIndex); //dispatch an update to list
    
    private function updateIndex():void {
        list.ensureIndexIsVisible(list.selectedIndex);
    }
    

提交回复
热议问题