Jumper
Jumper

Reputation: 133

Vaadin table clickable url

How I can make url's clickable in Table

 Table documentTable = new Table();

 documentTable.setContainerDataSource(new BeanItemContainer<>(MyClass.class, myClasses));

In MyClass I have

String url;

I want to display this url as link in my table.

Upvotes: 0

Views: 533

Answers (1)

Henri Kerola
Henri Kerola

Reputation: 4967

You can add a generate column to the table that "shadows" the original field/property and that column generator adds a link component to the cell. Here's an example by using Java 8:

table.addGeneratedColumn("url", (source, itemId, columnId) ->
  new Link("Click me", new ExternalResource("" + source.getContainerProperty(itemId, columnId).getValue()))
);

Upvotes: 2

Related Questions