3 Replies Latest reply: Aug 17, 2014 3:54 PM by Delcasda RSS

    Item renderer on DataGrid (not DataGridColumn)

    Andy Kirkham

      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