click-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <sab...@gmail.com>
Subject Re: How to show a image on a table column
Date Mon, 13 Oct 2008 15:13:57 GMT
Hi Marc,

Its usually best to ask on the user list so I'll cc there as well.


Marc Sulivan wrote:
> Dear friends I need to show an image on a table column. How can I do that?


The Decorator should do what you want:

Column column = new Column("image");

column.setDecorator(new Decorator() {
     public String render(Object row, Context context) {
         Customer customer = (Customer) row;
         String contextPath = getContext().getRequest().getContextPath();
         String pathToImage = customer.getPathToImage();
         // example image location -> /images/mycorp.jpg
         return "<img src='" + contextPath + pathToImage + "'/>";
     }
});

table.addColumn(column);

kind regards

bob

Mime
View raw message