0 Replies Latest reply on Aug 22, 2010 5:52 PM by Neat Gadget

    applying a different array for a combobox

    Neat Gadget Level 1
      I am having trouble applying a different array for a combobox


      I have created a datagrid, and then I am trying to use cellrenderer to put a combobox in a column.


      Normally I set up the datagrid, then use the following code to create the column that the combobox is going in:


      var column = new DataGridColumn("species_id");
      column.headerText = "species_id";
      column.width = 70;
      column.cellRenderer = "ComboBoxCell";


      A sample array I am wanting to add is [{label: "Test", data: 1}];


      The class is as follows:


      import mx.controls.ComboBox;
      import mx.controls.DataGrid;


      class ComboBoxCell extends MovieClip {


      private var _ccbMenu:ComboBox;
      private var listOwnerataGrid;
      private var owner:MovieClip;
      private var createClassObject:Function;
      private var getCellIndex:Function;
      private var getDataLabel:Function;


      function ComboBoxCell() {


      private function init():Void {
      createClassObject(ComboBox, "_ccbMenu", 1);
      _ccbMenu.dataProvider = [];
      _ccbMenu.addEventListener("change", this);


      private function change(oEvent:Object):Void {
      listOwner.editField(getCellIndex().itemIndex, getDataLabel(), _ccbMenu.value);


      public function getPreferredWidth():Number {
      return 100;


      public function getPreferredHeight():Number {
      return 25;


      public function setSize(nWidth:Number, nHeight:Number):Void {
      _ccbMenu.setSize(nWidth, _ccbMenu.height);


      public function setValue(sLabel:String, oItem:Object, sState:String):Void {
      _ccbMenu.visible = (oItem != undefined);
      for(var i:Number = 0; i < _ccbMenu.length; i++) {
      if(_ccbMenu.getItemAt(i).data == oItem[getDataLabel()]) {
      _ccbMenu.selectedIndex = i;




      Just not exactly how to do this