6 Replies Latest reply on Sep 6, 2010 6:25 AM by FlexPrashant

    itemrenderer in combobox

    FlexPrashant Level 1

      Hi I want to add some checkbox in my combobox at runtime .


      I have a arraycollection like this






             private var products:ArrayCollection = new ArrayCollection( [


             {product: "Executive Benefit Services", subProduct: ['Deferred Compensation']},


             {product: "Foreign Exchange", subProduct: ['Foreign Exchange']},


             {product: "Retirement Plan Services", subProduct: ['401(k) Consulting Services','401(k) Plan Services']}





      I am using a combobox :


      ComboBox id="cbProduct" dataProvider="{products}"  width="30%"

             labelField="product" itemRenderer="ComboBoxItemRenderer">



      where my renderer is like this :


      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
               import mx.controls.Label;
               import mx.controls.CheckBox;
               import mx.controls.Alert;
                     override public function set data(value:Object):void
                    if(value != null)
                       super.data = value;
                       var comboLen:int = value.subProduct.length;
                      // Alert.show(comboLen.toString() + 'lem');
                      /*  //show the comboBox
                       var lbl:Label= new Label();
                       lbl.text= value.product; */
                       for(var i:int=0;i<comboLen;i++)
                             var chb:CheckBox= new CheckBox();


      <label text={data.product} />


      this IR is adding double components  , means in 1st item it is adding 2 checkbox instead of one and in 2rd it is adding 4 instead of 2.