3 Replies Latest reply on May 5, 2009 7:20 AM by master.card

    how to initial selectIndex for list

    master.card Level 1

      For ComboBox and DataGrid, I try to setting its selectindex, but does not work.

       

      like:

      <mx:ComboBox

      id="principalProf" dataProvider="{principalprofiles}"

           creationComplete="initPrincipalProfile();"

           color="

      0x000000" />

       

      And:

          

           private function initPrincipalProfile():void {
                 this.principalProf.selectedIndex  = 2;

           }

       

       

           or

       

           private function initPrincipalProfile():void {
                  for (var i = 0; i < principalprofiles.length; i++) {
                       if(principalprofiles.getItemAt(i) == 'identi1' ) {
                             this.principalProf.selectedIndex = i;
                             break;
                       }    
                 }
                
          }

       

      But ComboBox list always select index from 0; May I know how to set select Index?

       

       

      Thnaks,