the drawRowBackground method is concerned with <mx:DataGrid> component.
My goal is to migrate my flex 3.2 application to a flex 4.5 application.
So it's necessary to use <s:DataGrid> component. But the drawRowBackground does not exist.
Could you give me a solution to have the same features of this method ? thanks.
this is the actionScript code :
override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
if (rowIndex == 11)
super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
Thanks in advance
Assuming your itemRenderers support the backgroundColor property (E.G. BorderContainer), this could work:
private function drawRowBackground(rowIndex, color):void
var renderer:* = dataGroup.getElementAtIndex(rowIndex);
This solution sucks though. A much better solution would be to create custom item renderers/skin states for your dataGroup. I suggest you read up on Spark datagroups and item renderers. It is more work to customize but you have immense freedom.
Look at the alternatingRowColorsBackground Component in the DataGrid skin. You can override the prepareGridVisualElement method to draw the 11th row the color you want.