1 Reply Latest reply on Jun 20, 2011 3:11 PM by Flex harUI

    Unable to Display check box for each cell of combo box

    MuskeeterAkshay

      Hi All,

         I am trying to display check box for each cell of a combobox ( using Flex 3.5 ) for that I have done following things:

       

      1) I have defined following class that extends checkbox and implements IListItemRenderer as below:

       

      import mx.controls.CheckBox;

      import mx.controls.listClasses.IListItemRenderer

      //import mx.controls.listClasses.ICellRenderer;

      import mx.controls.listClasses.ListData;

       

      public class CellRender extends CheckBox implements IListItemRenderer

      {

      private var _lstData:ListData;

      private var _dataObj:Object;

       

      public function CellRender()

      {

      }

       

       

      public function get lstData():ListData

      {

      return _lstData;

      }

       

      public function set lstData(ld:ListData):void

      {

      _lstData = ld;

      }

       

       

       

      public function get dataObj():Object

      {

      return _dataObj;

      }

       

      public function set dataObj(value:Object):void

      {

      _dataObj = value;

      }

       

      }

       

      Next I have created another class extends conbobox and have dropdown style to include check box:

       

      public class ClassLayerChooser extends ComboBox

      {

       

      public function ClassLayerChooser()

      {

      super();

      }

       

      override protected function createChildren():void{

      super.createChildren();

      //chkBox = new CheckBox();

      this.itemRenderer = new ClassFactory(ColorComboItem);

      this.labelField = "className";

      this.width = 160;

      this.rowCount= 7;

      this.dropdown.setStyle( "cellRender","CellRender");

       

      BindingUtils.bindSetter(classesChanged,datasetController,"currentDataset");

      BindingUtils.bindSetter(selectionChanged,this,"selectedItem");

       

      }

       

       

       

       

       

      override protected function commitProperties():void{

       

      }

       

      private function classesChanged(dataset:VODataset):void{

      this.dataProvider = ArrayCollection(dataset.classes);

      }

       

      private function selectionChanged(theClass:VOClassLayer):void{

      this.setStyle("fillColors",[theClass.color,theClass.color]);

      }

       

      public function set selectedID(value:int):void{

       

      }

      }

      }

      }

       

       

      But I don't see any checkbox against in the conbo box .  Am I missing something ?

       

       

         I would appreciate the suggestions for the same

       

       

      Thanks

      Akshay