1 Reply Latest reply on Aug 10, 2011 3:18 AM by Pooja Kuber

    Grid row not highlighting when clicking on custom itemrenderer

    vcbcpna3465

      Hi,

       

      I have a custom itemrenderer that somehow prevents the grid row not to be highlighted when a row is clicked (default grid behavior).  Is there a way around this?

      The renderer consists of a combobox and a label.  If the row is tagged as a new row (add button clicked), the combobox appears, otherwise, the text in the label shows.

      .

       

      Thanks in advance.

       

      Basic code is as follows :

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:HBox

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml"

      xmlns:parsley="

      http://www.spicefactory.org/parsley"

      textAlign="

      left" horizontalAlign="left"

      implements="

      mx.controls.listClasses.IDropInListItemRenderer">

      <mx:Script>

      <![CDATA[ ....

       

       

       

      public function get listData():BaseListData

      {

       

      return _listData;

      }

       

       

      public function set listData(value:BaseListData):void

      {

       

       

      if (value == null) return;

      _listData = value;

      }

       

       

      override public function get data():Object {

       

      if (cmbStrategies == null) return "";

       

      var s:String = cmbStrategies.selectedItem["data"];

       

      return s;

      }

       

      override public function set data(value:Object):void

      {

       

       

      super.data = value;

       

      this.init();

       

      if (value == null)return;

      // this.init();

       

       

       

      var s:String = value["strategy"];

       

      var isNew:Boolean = value["isNew"];

       

      var slabel:String = SSEStaticDataUtil.strategyCanonicalToLabelIdMapping[s];

       

       

      //if the row is not new, don't use the combobox, but the label

       

       

      if (!isNew) {

       

      this.cmbStrategies.includeInLayout=false;

       

      this.cmbStrategies.visible=false;

      lbldata.includeInLayout=

      true;

      lbldata.visible=

      true;

       

      this.lbldata.text=slabel;

      }

      else {

      lbldata.includeInLayout=

      false;

      lbldata.visible=

      false;

       

      this.cmbStrategies.visible=true;

       

      this.cmbStrategies.includeInLayout=true;

      }

       

      this.cmbStrategies.selectedIndex=findIndexInDropdown(s);

       

      super.invalidateDisplayList();

      }

       

      <mx:HBox

       

      textAlign="left" horizontalAlign="left">

       

      <mx:ComboBox

       

      change="handleChange(event)" dataProvider="{SSEStaticDataUtil.strategies}" id="cmbStrategies" height="16" width="100%">

       

      </mx:ComboBox>

      </mx:HBox>

      <mx:HBox

       

      textAlign="left" horizontalAlign="left">

       

      <mx:Label textAlign="left" id="lbldata" />

      </mx:HBox>

      </mx:HBox>