0 Replies Latest reply on Aug 17, 2006 5:49 PM by Josh Johnson

    Highlighting Selection Text in a Grid Using Custom Renderer

    Josh Johnson
      So in a previous thread I found the bug where selected text in a grid doesn't get highlighted, and as a workaround I implemented the check on 'change' and 'valueCommit' to run the setStyle command on the grid's textSelectedColor. All works fine, if you disregard the flicker.

      Now, I've had to create a custom renderer for one of my table cells, so that instead of just text, it displays an icon followed by the text in the cell. All works fine, except once again, my text doesn't get highlighted for cells using custom renderers.

      Is there an easy way to set the text color on these items using the same 'change' and 'valueCommit" events? How does one go about referencing items within a grid that are actually coming from a custom renderer?

      As an example, the custom renderer looks like this:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml">
      public var iconCompliant:String;
      public var iconNonCompliant:String;

      override public function set data(value:Object):void {
      if(value != null){
      super.data = value;
      if (value.servers == "compliant") {
      img.source = iconCompliant;
      compLabel.text = 'Compliant';
      img.source = iconNonCompliant;
      compLabel.text = 'Non-Compliant';
      <mx:HBox verticalAlign="middle" >
      <mx:Image id="img" source=""/>
      <mx:Label id="compLabel" text=""/>