title: Limit Flex Spark DataGrid ItemRenderer data to column
body: <p>I've got a DataGrid in my mobile application (I know, I know but there's currently not other solution for this), that numeric values. Depending on the value of a cell, the text gets colored. My big issue is that this doesn't work very for more than about 5 rows of data. I reckon the issue is that the set text function (in which I format the color) can't keep up with the amount of cell changes and formats the text based on the last updated cell of the row.
  I thought about a column item renderer so that the renderer only gets the value for that column, and not the whole data of the row.</p>
  
  <p>Is something like that possible?</p>
  
  <p>Just for reference, this is my current item renderer (again, this works fine for few rows, for 5+ of fast changing data, this doesn't work any more, cells get formatted even though their data hasn't changed).</p>
  
  <pre><code>public class ColorGridItemRenderer extends DefaultGridItemRenderer 
  {
      public function ColorGridItemRenderer() {
          super();
      }           
  
      override public function set text(value:String):void {
          if (!value)
              value = "";
  
          if(Number(value) &gt; Number(text) &amp;&amp; text!="")
                  setStyle("color", 0x40c040);
              else if(Number(value) &lt; Number(text) &amp;&amp; text!="")
                  setStyle("color", 0xf05050);
              else 
                  setStyle("color", 0xc1c1c1);
          }
  
          super.text = value;
      }
  }
  </code></pre>
  
  <p>Edit:
  I just double-checked and have to revert my previous statement. A single row works fine, the second row already messes up the color formatting though. It seems as if the datagrid somehow throws together the values.
  Doing the color formatting in the set data method shows the exact same effect;</p>
  
  <pre><code>override public function set data(value:Object):void {
  
          if(value &amp;&amp; data) {
  
              label = value[column.dataField];
  
              if(value[column.dataField] &gt; _oldVal &amp;&amp; _oldVal != 0)
                  setStyle("color", 0x40c040);
              else if(value[column.dataField] &lt; _oldVal)
                  setStyle("color", 0xf05050);
              else 
                  setStyle("color", 0xc0c0c0);
  
              _oldVal = value[column.dataField];  
          }
          super.data = value;
  
      }
  </code></pre>
  
  <p>Edit2:
  My assumption about the grid messing up the ItemRenderer's data seems to be correct.
  A simple trace in the set data method (trace("old: " + _oldVal + "new : " + value[column.dataField]);) revealed that somehow, values of the next grid row (in case there are 2) get used as well as _oldVal gets the old value of the next row. </p>