March 11th, 2011, 03:12 PM
Bind image to cfgrid
I have a HTML cfgrid that I'm trying to bind an image to so that as they select each item in the grid I than show the picture associated with that record next to the grid. It seems like I should be able to do this with a cfinput type=image and a bind statement, but I can't seem to figure out the syntax to make it work.
I've done a bit of looking and it seems everyone is using flash forms to show images with cfgrid, but can't seem to find any answers on how to make this work with an HTML cfgrid. I'm not trying to show the image within the cfgrid, just a way to show it next to it without having to use frames.
Is this possible?
March 11th, 2011, 05:39 PM
// Set init() to run when the page loads using AjaxOnLoad().
grid = ColdFusion.Grid.getGridObject("MyGrid");
grid.addListener( "rowclick", gridRowClickHandler );
function gridRowClickHandler( grid, rowIndex, e )
var record = grid.getDataSource().getAt(rowIndex);
var imageURL = record.data.imageURL; // Or whatever key you're using to store the image URL
document[img_name].src = imageURL;