0 Replies Latest reply on Oct 28, 2009 8:42 AM by SusieIre

    Create combo box in datagrid from database with different dataprovider

    SusieIre

      Hi,

       

      I'm very new flex and would very much apprieciate some help. I have a datagrid pulling information from a dataprovider. Within this datagrid I need to create a combox pulling values from another dataprovider and save the choosen value back to the db.

       

      I have created a combo box successfully with the values from the different dataprovider , but when the user chooses a value nothing happens and the combox box goes back to first value.

       

      I've posted the code below, this could be completely incorrect so please let me know if I should be going in a different direction.

       

       

      Code calling within the datagrid -

       

       

       

       

       

       

       

       

      <mx:AdvancedDataGridColumn

       

      dataField="ACTSTATUS" rendererIsEditor="true" editorDataField="value">

       

       

      <mx:itemRenderer>

      <mx:Component

      >

       

      >

      >

       

       

       

       

       

       

       

       

       

       

       

      <mx:ComboBox initialize="outerDocument.addData(event)" prompt="- select an item -" labelField="label"

      change="outerDocument.changeEvt(event)" enabled="

       

      true" visible="true" /></mx:Component></mx:itemRenderer>

       

      Code for changeEvt not working  -

       

      public function changeEvt(event:Event):void {

      //setting item in main datprovider to be choosen value

       

       

      for(var i:Number=0; i<modulesList.length; i++)

      {

       

      if (modulesList[i].SELECTED == true)

      { modulesList[i].ACTSTATUS = event.currentTarget.selectedItem.data

      }

       

      }

      //attempting to set combo box to choosen value.

       

       

      for (var x:Number=0; x<(actionStatusList.length); x++){

       

      if(actionStatusList[x].data==event.currentTarget.selectedItem.data)

      { event.currentTarget.selectedIndex=x;

       

      taTest1.text=x.toString()+actionStatusList[x].data+event.currentTarget.selectedItem.data+e vent.currentTarget.selectedIndex; }

      }

       

      }