1 Reply Latest reply on Mar 1, 2011 8:56 AM by abhishek011

    Combobox in datagrid- Flex2 ?

    abhishek011
      Hi All,

       

      I am facing issue with combox in datagrid. I have a simple datagrid with two columns. One column is combobox.Now..
      1. I click on combobox (I am not selecting or changing any value in combobox).
      2. Now when i move cursor up or down in datagrid, scrollbar in datagrid moves up or down with the cursor. I am not sure why it is happening.
      I am using Flex 2 . Is there some issue with flex 2 or i am doing something wrong.Need your help.

       

      TestProject.mxml

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initApp()">
       
       <mx:Script>
        <![CDATA[
         import mx.controls.Alert;
         import mx.collections.ArrayCollection;
         [Bindable] public var testArray:Array= [1,1,1,1,1,11,1,1,1];
        [Bindable] public var testArrayCollection:ArrayCollection = new ArrayCollection(testArray);
        [Bindable] public var invdlAssignmentList:ArrayCollection = new ArrayCollection();
        [Bindable] public var dataCen:CensusEventPptDetail;
        private function initApp():void{
         var i:int;
         for(i = 0;i<100;i++){
          dataCen = new CensusEventPptDetail();
          dataCen.age = i.toString();
          invdlAssignmentList.addItem(dataCen);
         }
         
        }
        
        
        ]]>
       </mx:Script>
       <mx:Panel >
        <mx:DataGrid id="invdlLeadCart"   dataProvider="{invdlAssignmentList}" 
         fontSize="10" width="100%" height="75%" >
        <mx:columns>
         <mx:DataGridColumn dataField="age" id="InvdlProgram"     headerText="Age"    headerWordWrap="true" width="160" />
         <mx:DataGridColumn dataField="cbData"     id="InvdlLeadRecipient"    headerText="ComboBox"  headerWordWrap="true" width="230" >
          <mx:itemRenderer> 
           <mx:Component >
             <mx:ComboBox  dataProvider="{this.parentApplication.testArrayCollection}" 
               change = "onChange(event)"  fontSize="9"  height="20" width="220">
              <mx:Script>
                              <![CDATA[
                               import mx.controls.Alert;
                               private function onChange(evt:Event):void {
                                  Alert.show("CB changed");
      
                                    }
                                ]]>
                                </mx:Script>
             </mx:ComboBox>
           </mx:Component>
          </mx:itemRenderer>
         </mx:DataGridColumn>
        </mx:columns> 
       </mx:DataGrid>
       </mx:Panel>
      </mx:Application>
      

       

      CensusEventPptDetail.as

       

      package
      {
          import mx.collections.ArrayCollection;
          import mx.core.IUID;
          
       [Bindable]
       public class CensusEventPptDetail 
       {
        
        public var birthDate:String;
        public var age:String;
        public var cbData:String;
        
        
       }
      }
      Thanks
      Abhishek