PDA

View Full Version : cellrenderer with datagrid


delda
10-24-2007, 10:48 AM
hello all
i have problem here loading images into datagrid
this datagrid load dynamically data from xml file also this xml file has the url for those images i tried alot of method all come to faliure in the end tll i have searched the Internet and as.org i have found this method that call
cellrenderer
can any one help how to use this cellrenderer ??
i searched on F[8] help i found nothing much also the official online documentation
and also found it in as.com
but loading from cfc file or asp

can any one help please
thanks in advance

ryryguy
10-24-2007, 06:35 PM
Well, do you understand how the data provider works? Assuming that you do, I think that if you use an ImageCell for the cell renderer rather than the default CellRenderer, you can feed it images.

so change the style of your data grid like this:

myDataGrid.setStyle("cellRenderer", "fl.controls.listClasses.ImageCell")

Then, use the getCellRendererAt method to get at the ImageCell instance for a given cell, and stick the image URL in its source property:

var renderer:ImageCell = myDataGrid.getCellRendererAt(row, col) as ImageCell;
renderer.source = myURL;

I think that should work... A potential problem is that you must use the ImageCell renderer for all cells, which may not look the way you want if some cells don't contain images. But I don't think there's a way to set different renderers on different cells. If it's an issue you could potentially extend ImageCell to make a custom class that handles cells without images differently.

delda
10-25-2007, 06:40 AM
thank u so much but it dosen't work at all