2 Replies Latest reply on Jul 6, 2009 3:03 PM by joan_lafferty

    ItemRenderer not working?

    Handycam Level 1

      I have a datagrid.  One of the fields is a URL to an image, so I am going to display an image there.  In the past, I have created a MXML component with an Image component and used that.  However, in FB4 it's not working:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" width="400" height="300">
           <s:layout>
                <s:BasicLayout/>
           </s:layout>
           <mx:Image source="{data.thumbnailURL}" width="120" height="67"/>
      </s:Group>
      
      

      It is complaining "1120: Access of undefined property data."

       

      Is there something diffeent I am missing here?

        • 1. Re: ItemRenderer not working?
          emphasized

          use

          <s:ItemRenderer....

           

          instead of

           

          <s:Group...

          • 2. Re: ItemRenderer not working?
            joan_lafferty Adobe Employee

            DataGrid is one of our legacy "Halo" components, not, one of the "Spark" components using the new Flex 4 Spark architecture. Group is a new Spark component. We are not supporting using a Group or other Spark components as an itemRenderer for a DataGrid. I recommend using a Halo container instead of Group. The Halo containers implement IDataRenderer and IListItemRenderer allowing you to use them as itemRenderers for DataGrid. So, you'll have something like:

             

            <?xml version="1.0" encoding="utf-8"?>
            <s:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/halo" width="400" height="300">
                 <mx:Image source="{data.thumbnailURL}" width="120" height="67"/>
            </s:Canvas>

             

            If you were using a Spark List (<s:List />) instead of a DataGrid, then, you could use Group as an itemRenderer.

             

            HTH,

            Joan