How can an mxColumn.itemRenderer be set by copying a sparkColumn.itemRenderer during runtime?
I have an app that uses mx:DataGrid, mx:AdvancedDataGrid, and s:DataGrid.
We're implementing a "print" feature, using mx:PrintDataGrid and mx:PrintAdvancedDataGrid.
We set the printable dataGrid's columns to the columns of the dataGrid we want to print, like this:
printDataGrid.columns = targetDataGrid.columns; //or
printAdvancedDataGrid.columns = targetDataGrid.columns;
Doing it this way, the print retains the format of the itemRenderers.
When the dataGrid-to-print is spark, the columns are iterated, and new spark columns made
for (var i:uint; i < sparkColumns.length; i++)
{
sparkColumn = sparkColumns.getItemAt(i) as GridColumn;<br/>
mxColumn = new DataGridColumn();<br/>
mxColumn.headerText = sparkColumn.headerText;<br/>
mxColumn.dataField = sparkColumn.dataField;<br/>
//mxColumn.itemRenderer = sparkColumn.itemRenderer;<br/>
mxColumns.push(mxColumn);
}
The dataField and headerText properties translate easily from mx to spark columns, but the itemRenderers are trickier.
How can the mxColumn.itemRenderer be set to the sparkColumn.itemRenderer?
Does anyone know how to scoop out the components/functions/properties in the spark itemRenderer? How to "type-cast" that to an mx itemRenderer?