View Full Version : How to render image in grid by reading from local disk

25 Feb 2010, 5:39 AM
Hi everybody,

I am simply trying to render image in grid by reading the image from local disk but canít get it to work.

Code is as follows:

List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig thumbnail = new ColumnConfig("thumbnail", 40);
thumbnail.setRenderer(new GridCellRenderer<ModelData>() {
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<ModelData> store, Grid<ModelData> grid) {
String imgSrc = "D://home.jpg";

// Image image = new Image();
// image.setUrl(imgSrc);
// image.setHeight("30");
// image.setWidth("40");
// return image;

return new Html("<img src=\"" + imgSrc + "/>");

Do you have any suggestions what to do ?

25 Feb 2010, 6:09 AM
Your imgSrc should look something like this...


That might trigger security warnings in certain situations.