You can amend this to an ADG most likely. I work with Flex 3.6 mostly, so I'm
not sure if it will port to Spark components or not.
public class RowFontColorDataGrid extends DataGrid
{
public var rowColorFunction:Function;
public function RowFontColorDataGrid()
{
super();
}
override protected function drawRowBackground(s:Sprite, rowIndex:int,
y:Number, height:Number, color:uint, dataIndex:int):void
{
if (this.rowColorFunction != null && this.dataProvider != null)
{
var item:Object;
if (dataIndex < dataProvider.length)
{
item = dataProvider[dataIndex];
}
}
if (item)
{
color = rowColorFunction(item, rowIndex, dataIndex, color);
}
super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
}
}
Then use something like this in place of your current ADG
<dataGrid:RowFontColorDataGrid id="HistoryGrid" width="100%" height="100%"
sortableColumns="false" variableRowHeight="true"
rowColorFunction="calcRowColor" >
And this in your script
public function calcRowColor(item:Object, rowIndex:int, dataIndex:int,
color:uint):uint
{
if (item.hasOwnProperty("Role") && item.Role == "Reviewer")
return 0xFFFFFF;}
On Monday, September 28, 2015 5:06 PM, jfb <[email protected]>
wrote:
Thanks for you quick reply and help.
Do you know how to set the row color based on a condition?
This is the ADB style function:
private function ADB_style(data:Object,
col:ExtendedAdvancedDataGridColumn):Object{
if ( data[col.dataField] != null){
if ( data[col.dataField] == "Condition"){
return {color:0xFF0000};
}
}
return {};
}
Best,
--
View this message in context:
http://apache-flex-users.2333346.n4.nabble.com/Advanced-datagrid-row-color-tp11247p11249.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.