3 Replies Latest reply on Oct 8, 2009 7:15 AM by rgadiparthi

    Select value in combobox (itemEditor)

    mangemuck

      Hey!

       

      I've created an application with a combobox inside an itemEditor (datagridcolumn).

       

      I have two dataproviders. One with the data to be filled into the DataGrid, and one with the data to be filled into the ComboBox. How do I get the ComboBox to select the correct value on creation?

       

      I've searched to forum, but it refers to sites where the document is gone.

       

      <?xml version="1.0"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">    
          <mx:Script>
              <![CDATA[                
                  import mx.collections.ArrayCollection;
              
                  [Bindable]
                  private var inDataGrid:ArrayCollection = new ArrayCollection([
                      {account:13, sumD:0, sumK:15},
                      {account:2, sumD:0, sumK:15},
                      {account:12, sumD:30, sumK:0}     
                  ]);
      
                  [Bindable]
                  public var inComboBox:ArrayCollection = new ArrayCollection([
                      {label: "1510 - Kundfordringar", id:14},
                      {label: "1910 - Kassa", id:13},
                      {label: "1920 - Bank", id:2},
                      {label: "2040 - Lev.fordringar", id:12}     
                  ]);
                  
      
              ]]>
          </mx:Script>
      
          <mx:DataGrid id="myGrid" dataProvider="{inDataGrid}" 
              variableRowHeight="true" 
              editable="true">
              <mx:columns>
              
                  <mx:DataGridColumn dataField="label" headerText="Konto">
                       <mx:itemEditor>
                            <mx:Component>
                                 <!-- What to do here? -->
                                 <mx:ComboBox dataProvider="{outerDocument.inComboBox}" 
                                      labelField="label" />
                            </mx:Component>
                       </mx:itemEditor>
                  </mx:DataGridColumn>
                  
              </mx:columns >
          </mx:DataGrid> 
      </mx:Application>
      

       

      I'm looking forward to an answer,

      Magnus