3 Replies Latest reply on Nov 15, 2007 6:13 AM by Cheree Singal

    drawRowBackground in DataGrid

    goingflex Level 1
      Can someone give me an example on how to use drawRowBackground in a DataGrid. I want to colour some rows based on data in the columns.

      I saw Peter Ent's examples in his Blog but can not figure out how to use this in a <mx:DataGrid..... or <mx:DataGridColumn .....

      Here is his code on his Blog: http://weblogs.macromedia.com/pent/

      override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
      var dp:ArrayCollection = dataProvider as ArrayCollection;
      var item:Object;
      if( dataIndex < dp.length ) item = dp.getItemAt(dataIndex);
      if( item != null && item.year < 20000 ) color = 0xFF8800;
      else if( item != null && item.year>= 2000 ) color = 0xFFFFFF;
      else color = 0x00CC00;