1 Reply Latest reply on Aug 2, 2010 12:59 AM by BhaskerChari

    how bind data into dropdown in grid

    jinsojose

      I have one dropdown in datagrid.The grid values should load from db, and the dropdown values should load from db.

      For me the values are coming into arraycollection.How we can bind into dropdown inside datagrid

      Please give me a solution for this problem.

      i am very new to flex

        • 1. Re: how bind data into dropdown in grid
          BhaskerChari Level 4

          Hi jinsojose,

           

          Here is the sample code you needed...

           

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
             <mx:Script>
             <![CDATA[
              import mx.controls.Alert;
               
                [Bindable]private var myAC:Array = [
                   {EmpId:1001, Ename:'Harish',  EmpDepartment:[{Id:1,Name:"IT"},{Id:2,Name:"HARDWARE"},{Id:3,Name:"NETWORK"}]},
                   {EmpId:1002, Ename:'Bhasker',  EmpDepartment:[{Id:2,Name:"HARDWARE"},{Id:1,Name:"IT"},{Id:3,Name:"NETWORK"}]},
                   {EmpId:1003, Ename:'Pavan',  EmpDepartment:[{Id:3,Name:"NETWORK"},{Id:1,Name:"IT"},{Id:2,Name:"HARDWARE"}]},
                   ];
                     
             ]]>
             </mx:Script>

          <mx:DataGrid id="dataGrid" dataProvider="{myAC}" x="10" y="177" visible="true">          
            <mx:columns>
             <mx:DataGridColumn  headerText="SLNO" itemRenderer="mx.controls.RadioButton"/>           
             <mx:DataGridColumn dataField="EmpId" headerText="Names" />           
             <mx:DataGridColumn dataField="Ename" headerText="Passwords"/>
             <mx:DataGridColumn headerText="CPasswords">
              <mx:itemRenderer>
               <mx:Component>
                <mx:ComboBox dataProvider="{data.EmpDepartment}" labelField="Name"/>
               </mx:Component>
              </mx:itemRenderer>
             </mx:DataGridColumn>
            </mx:columns>
          </mx:DataGrid>
          </mx:Application>

           

           

          If this post answers your question or helps, please kindly mark it as such.


          Thanks,

          Bhasker Chari