Question

I create a small CellTable with gwt. In that table I would like to add some images. For this I use following code:

Column<Company, String> columnflag = new Column<Company, String>(new ImageCell()) {
    public String getValue(Company company) {
        return company.getImageSmall();
    }
  };

This works fine. But I would like to change the size of the image? Does anyone know how I could do this? I have nothing found... Set a fix column width and height does not help.

Greetz

Was it helpful?

Solution

You can try the following code:

ImageCell imageCell = new ImageCell() {
    @Override
    public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) {
        super.render(context, value, sb);
        String imagePath = "images/yourImage.png";
        sb.appendHtmlConstant("<img src = '"+imagePath+"' height = '20px' width = '20px' />");

    }
};
Column<Company, String> columnflag = new Column<Company, String>(imageCell) {
    @Override
    public String getValue(Form object) {
            return "";
    }
};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top