View Full Version : add image in a column of a grid with tooltip

7 Aug 2009, 3:06 AM

I am having a grid and I want to use in a little image like a question mark in just one column (in the cells, not in the header) where you can read further information via tooltip. Either I have any idea how to do that nor the are any examples.

If someone could help me with that, whould be very kind.


7 Aug 2009, 3:49 AM

You need to create a GridCellRenderer, and set that renderer to your ColumnConfig, via the method setRenderer.

Your GridCellRenderer should return your image, with your tooltip.

This is one example:

new GridCellRenderer<BaseModel>() {
public String render(BaseModel model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<BaseModel> store, Grid<BaseModel> baseGrid) {
String tooltip = "your_tooltip";
return "<h1 align=\"center\"><img src=\""+img+"\" qtip=\"" + tooltip + "\"/></h1>";

7 Aug 2009, 6:01 AM
Thank you ver much, this is working.

Just a further question, why is the image date not found, when I did put it in the "war"-folder?

AbstractImagePrototype img = IconHelper.createPath("logo.gif",10,10);

7 Aug 2009, 6:40 AM
Because I guess you have to use the complete url.
Try it like this, and see if it helps you:

AbstractImagePrototype img = IconHelper.createPath(GWT.getModuleBaseURL() + "logo.gif",10,10);

7 Aug 2009, 6:50 AM
I already used the complete URL and it still doesn't work with GTW...

I don't know why it can't find the data. Is there another way to create an image?

15 Sep 2009, 3:20 AM
Tried this?

Image img = IconHelper.createPath("logo.gif",10,10).createImage();