title: Flex 4: Dynamically created DataGrid with custom ItemRender, problem detecting right cell
body: <pre><code>  &lt;mx:DataGrid id="calendarGrid" 
                 dataProvider="{rows}"
                 width="100%" 
                 height="100%"&gt;
      &lt;mx:columns/&gt;
    &lt;/mx:DataGrid&gt;
  </code></pre>
  
  <p>I dynamically add columns and rows to it in this way:</p>
  
  <pre><code>    var dgc0:DataGridColumn = new DataGridColumn("timeSlot");
      dgc0.headerText="Hours";
      hoursColumns=new Array();
      hoursColumns.push(dgc0);
  
  for (var i:int=7;i&lt;21;i++)
  {
     var dgc:DataGridColumn = new DataGridColumn();
     dgc.headerText=i+":00-"+(i+1)+":00";
     dgc.itemRenderer=new ClassFactory(CustomRenderer);
     hoursColumns.push(dgc);
  }
  
  calendarGrid.columns=slotsColumns; 
  
  for(var i:int =0;i&lt;maxNum+1;i++)
  {
     rows.addItem({timeSlot:"Day n° "+(i+1)});
  }
  </code></pre>
  
  <p>My CustomRenderer detects user clicks and changes the color of the selected cell.
  When I select one cell on, say, the first column, it is colored but if I select another cell on the same column the first one is uncolored and the second isn't colored.
  Maybe the same renderer is used for all cell in the column?
  There's a way to avoid it?</p>
  
  <p>Thanks a lot.</p>