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

Reply via email to