DgcDaaGridColumn.itemRenderer = new ClassFactory(MyHBoxWrappingTwoLabels);

Use ContextualClassFactory if you are embedding fonts.


On 1/20/10 1:18 AM, "pullzmag" <[email protected]> wrote:






Hi,

I have decided to post it again since the original email has been attached, 
don't know why, to "Displaying additional child nodes in Datatip" 
(http://tech.groups.yahoo.com/group/flexcoders/message/151579) thread.

I need an itemRenderer in my DataGrid (id: dgDataGrid) so it displays two 
different strings (string1 and string2 - see the explanation part for more info 
about how these strings are defined in the array). I have created the 
itemRenderer as mxml, with HBox wrapping two labels. How can I populate their 
text values, considering that the function for creating columns in the 
dgDataGrid is as follow:

private function updateDataGrid():void
{
var aDataGridColumns:Array = new Array();

for (var i:uint = 0; i < _aYears.length; i++)
{
var dgcDataGridColumn:DataGridColumn = new DataGridColumn( _aYears[i] );
dgcDataGridColumn.headerText = String( _aYears[i] );
aDataGridColumns.push( dgcDataGridColumn );
}

 dgDataGrid.columns = aDataGridColumns; }

Explanation:

- _aYears is an array storing years, eg. 2002, 2003, 2004,
- dataProvider for the dgDataGrid is set to _acData, which is an array 
collection wrapping aData array,
- data in aData array can be accessed as

aData[sYear] = aYearDetails;

where aYearDetails is created as:

aYearDetails.push({ string1:string1Value, string2:string2Value })

Thanks!
Greg






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to