2 Replies Latest reply on Mar 30, 2010 1:33 PM by Muaddib2004

    DataGrid row not selectable when using custom itemRenderer

    Muaddib2004

      I have placed created a custom itemRenderer for use in a DataGrid within Flex 3.2   However, when I click within the cell of the grid using that itemRenderer, the row is not being selected.(the DataGrid.selectable property is set to TRUE).  Removing the use of the renderer brings back the expected functionality. Here is my item renderer, is there any reason why I should expect this behavior?  I have other itemRenderers that dont cause this, but their anatomy is the same.... nothing obviously different about them.

       

      Thanks,

      Muaddib

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
          width="100%"
          horizontalAlign="center">
          <mx:Script>
              <![CDATA[           
                  static private var millisInSec:int  = 1000;
                  static private var millisInMin:int  = 60 * millisInSec;
                  static private var millisInHour:int = 60 * millisInMin;
                  static private var millisInDays:int = 24 * millisInHour;
                  static private var unknownMsg:String = "UNKNOWN";
                 
                  public var _data:Data;
                  private var _valueUpdated:Boolean = false;

       

                  private function getFriendlyFormat(millis:Number):String {

                      ...

                      return formattedString;
                  }
                 
                  override public function set data(value:Object):void{
                    if(null == value)
                        return;

       

                    var newData:Data= value as Data;
                    if(newData!= _data){
                        _data= newData;
                        _valueUpdated = true;
                    }
                  }
                 
                  override protected function commitProperties():void {
                      if(_valueUpdated){
                          var finalDate:Date = new Date();
                          // update "timeLabel" based on_data
                          _valueUpdated = false;
                      }
                  }
              ]]>
          </mx:Script>
          <mx:Label id="timeLabel" />
      </mx:HBox>