It seems that all the published examples of using an item renderer on a DataGrid use the itemRenderer property of DataGridColumn.
I don't think I can do this because my columns are created at run time, depending on the contents of the data provider.
I have therefore tried to assign my item renderer (a subclass of Canvas) directly to the DataGrid.
1. This works in MXML when the renderer is inline.
2. It sees to work when the renderer is an Actionscript class assigned to the DataGrid's itemRenderer property.
3. It does NOT work when the renderer is Flex component assigned to the DataGrid's itemRenderer property. This compiler error is reported: Initializer for 'itemRenderer': cannot parse value of type mx.core.IFactory from text 'comp:CellRenderer'.
I prefer to use the last method. Is there a way to fix this error?
If not, is it possible to attach the item renderer to each DataGridColumn as it is created? DataGrid does not seem to have a suitable event that reports when a column is created.
Aplogies if this is elementary stuff. I am a real Flex newbie. I am using Flex Builder 3.0
Andy Kirkham
A code example would be helpful here, but from your error message it
looks like you may be doing the following
<mx:DataGrid itemRenderer="comp:CellRenderer"/>
Instead of this, you need to use the fully qualified class name of
CellRenderer, eg.
com.renderers.CellRenderer
Look at the definition of 'comp' towards the top of your MXML file, it
will be something like:
xmlns:comp="blah.blah.blah.*"
Your itemRenderer property should then be set to:
blah.blah.blah.CellRenderer
Excellent! That seems to be the answer. Thanks
Andy
4 years later this solve my problem with a spark renderer