Tuesday, December 6, 2011

drawRowBackground in DataGrid

Hi

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 %26lt;mx:DataGrid..... or %26lt;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 %26lt; dp.length ) item =
dp.getItemAt(dataIndex);

if( item != null %26amp;%26amp; item.year %26lt; 20000 ) color =
0xFF8800;

else if( item != null %26amp;%26amp; item.year%26gt;= 2000 ) color
= 0xFFFFFF;

else color = 0x00CC00;


super.drawRowBackground(s,rowIndex,y,height,color,dataIndex);

}



Thanks.



drawRowBackground in DataGrid
this site might help ya




http://samples.faratasystems.com/AdvancedDataGrid/index.html



JoShdrawRowBackground in DataGrid
thanks very much josh. It was very helpful.


Hi Josh,

The site you mentioned is very useful. Do you know of any
such site for Trees:)

I tried to search but dint find any thing.



TIA

Chere

No comments:

Post a Comment