This interface provides a method that dynamically created visual
elements can use to configure themselves before they're displayed.
It's called as needed when a factory generated visual element
is created or reused. It is not intended to be called directly.
This is an optional interface for all of the factory-generated
visual elements except itemRenderers: caretIndicator,
hoverIndicator, editorIndicator,
selectionIndicator, columnSeparator,
rowSeparator,
alternatingRowColorsBackground (see DataGrid),
sortIndicator (see GridColumnHeaderGroup). It's
typically used to configure generated visual elements with
DataGrid's style values. For example, to use the value of the
DataGrid's "symbolColor" style for the caret's fill color,
one would define the prepareGridVisualElement()
method like this:
public function prepareGridVisualElement(grid:Grid, rowIndex:int, columnIndex:int):void
{
caretStroke.color = grid.dataGrid.getStyle("caretColor");
}
The rowIndex and columnIndex parameters specify the
the cell the visual element will occupy. If columnIndex = -1 then the visual element
occupies a Grid row. If rowIndex = -1 then the visual element occupies
a Grid column.
There are many more examples like this in DataGridSkin.mxml. Note that custom
DataGrid skin visual elements can choose not to implement this interface if the
the added flexibility isn't needed.
This method is called before a visual element of the Grid is rendered to give the
element a chance to configure itself.
IGridVisualElement
Method Detail
prepareGridVisualElement
()
method
public function prepareGridVisualElement(grid:Grid, rowIndex:int, columnIndex:int):void
Language Version :
ActionScript 3.0
Product Version :
Flex 4.5
Runtime Versions :
Flash Player 10, AIR 2.0
This method is called before a visual element of the Grid is rendered to give the
element a chance to configure itself. The method's parameters specify what
cell, or row (if columnIndex = -1), or column (if rowIndex = -1) the visual
element will occupy.
If the visual element is generated by a factory valued
DataGrid skin part, like selectionIndicator or hoverIndicator,
then grid.dataGrid will be the DataGrid for which
grid is a skin part.
Parameters
grid:Grid — The Grid associated with this visual element.
rowIndex:int — The row coordinate of the cell the visual element will occupy, or -1
columnIndex:int — The column coordinate of the cell the visual element will occupy, or -1