1 Reply Latest reply on Aug 2, 2012 5:44 AM by hobbes26

    s:MXAdvancedDataGridItemRenderer

    hobbes26

      Hi, I need an s:MXAdvancedDataGridItemRenderer that will change the color and fontweight(bold) for the whole line at depth 2 when a particular column is greater than 1.68. Here is what I have so far and, unfortunately, it does not seem to work:

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:mx="library://ns.adobe.com/flex/mx" 
                focusEnabled="true">
       <fx:Script>
        <![CDATA[
         import mx.states.SetStyle;
         override public function set data(value:Object):void
         {
          super.data = value;
          if(value["prob"] >= 1.68)
          {
           this.setStyle('color', '#0000FF');
           this.setStyle('fontweight', 'bold');
          }        
         }
        ]]>
       </fx:Script> 
      </s:MXAdvancedDataGridItemRenderer>
      

      I don't mind having to attach the renderer to every single column if there is no better option but you would think that it would be possible to change the whole row based on one simple condition. Thanks for any help or leads on this.  E.

        • 1. Re: s:MXAdvancedDataGridItemRenderer
          hobbes26 Level 1

          I solved my own problem. For those interested here is my solution. I added a styleFunction on the AdvancedDataGrid itself - i.e. not on the columns and no itemRenderer either.

           

          protected function stddevStyle(data:Object, col:AdvancedDataGridColumn):Object

            {

              if(data["prob"] >= 1.68)

                {

                  return {color:0x0000FF, fontWeight:'bold'};

                }

              else

                {

                  return null;

                }

            }

           

          HTH,  E.