3 Replies Latest reply on Dec 25, 2006 4:42 PM by Hugo_Core

    Display and Image in a Datagrid

      How do I display an image in a datagrid column when the file location is provided in the results of a database query? In ColdFusion I simply set the datagrid column to be an image within the datagrid column tag. I want to do the same thing in Flex but have not see any documentation on how this is done. Is anyone doiong something like this in their applications?
        • 1. Re: Display and Image in a Datagrid
          xyco45 Level 1
          I have actually done soemthing excatly like what your trying to do although I was recieving the information from teh database through a object created through a web service. how is your flex app obtaining the data?

          Just on a side note so you know, flex can not communicate directly with a database it always has to be through some sort of middle man.
          • 2. Re: Display and Image in a Datagrid
            Andrew_Lattimore Level 1
            I went back and reviewed the Flex Developer's Guide again. There is a section on ItemRenderer that gave me some insight on how the datagrid works.

            Essentially, I used the result set returned from my cfc through a webservice, assigned the dataField to the variable that contains the string that points to the directory when the image is located, and then used the following syntax:

            <mx:DataGridColumn headerText="80% RATING" dataField="80_RATING">



            <mx:Image horizontalAlign="center" />




            I believe the syntax is telling Flex to render the dataField variable as a Component of type Image.

            The application that I built is an enterprise reporting system that assigns red, yellow, green ratings based on the calculated value for the item being evaluated. I've tested this and it works perfectly...it even has better performance than ColdFusion.

            • 3. Re: Display and Image in a Datagrid
              Hugo_Core Level 1

              Would be better if you use a TileList with a HBox render ?

              The examples i have seen with yours needs use this system..

              Per example, the Flex Store product browser.. Have Image and Labes etc..

              But use a TileList scripting advanced..

              Sry by the bad help, but litte time :(
              Core, Regards..