Flex selectCombobox()

Problem: You programmically are selecting an item from a combobox.

Solution: The function below! Pass the combobox, column you're matching, and the value to match on.

private function selectCombobox(cb:ComboBox, column:String, value:String):void{
   if( value == null )
      return;
   
   for( var i:int=0; i<cb.dataProvider.length; i++ ){
      if( value == String(cb.dataProvider[i][column]) ){
         cb.selectedIndex = i;
         break;
      }
   }
}

Related Blog Entries

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner