1 Reply Latest reply on Jun 11, 2009 6:37 AM by Gregory Lafrance

    Data not binding in Combobox

    KNamuduri

      Hi All,

       

      I am have been trying to do simple data to Combox using remote object.

       

      When I bind the data to DataGrid, I can see the data coming through. But when trying to assign it to Combobox by converting the result of remote object to Arraycollection. I have also provided the labelfield of the combobox but still no luck.

      I am providing the code below. Please help I need to finish a presentation.

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  applicationComplete="LoadDomains()" xmlns:ns1="Components.*">
                  <mx:Script>
                  <![CDATA[
                  import mx.controls.Alert;
                  import mx.utils.ArrayUtil;
                  import mx.events.DropdownEvent;
                  import mx.collections.ArrayCollection;
                  import mx.rpc.events.ResultEvent;
                  import mx.rpc.events.FaultEvent;
                 
                  [Bindable] public var dpItemType:ArrayCollection;
                        
                  private function LoadDomains():void
                  {
                 
                  rptRoDomains.getDomains.send();
                  //    dpItemType = new ArrayCollection(ArrayUtil.toArray(rptRoDomains.getDomains.lastResult));
                      //    this.ItemTypeRO.getItemTypeByDom.send();
                  }
                  ]]>
                  </mx:Script>

      //Remote Objec call
      <mx:RemoteObject id="rptRoDomains"  destination="domains" showBusyCursor="true"  fault="Alert.show(event.fault.faultString, 'Error');"/>

      <mx:HDividedBox>

      // Assiging it to Data grid which works
              <mx:DataGrid id="dgDomList"   dataProvider="{rptRoDomains.getDomains.lastResult}" width="30%" height="100%"   >
               <mx:columns>
              <mx:DataGridColumn dataField="dom" headerText="Domain" />
              </mx:columns>
              </mx:DataGrid>
              <mx:HBox>

       

      // Problem Area

      <mx:ComboBox id="cbItemType" width="150" prompt ="Select the ItemType " labelField="dom" dataProvider="{ArrayUtil.toArray(rptRoDomains.getDomains.lastResult)}"  >
         
      </mx:ComboBox>

       

      </mx:HBox>
      </mx:HDividedBox>

       


      </mx:Application>