Reputation: 5119
I have a table in Vaadin that display data depending on the data type selected in a Tree. For URL type data it shows a row (two columns) URL and the actual URL in the other but is displayed as plain text. I would like that URL to be clickable and opened in another window.
I tried adding a Link to that case but it displays something like com.vaadin.ui.Link@596bf9 instead of the actual link. Here's the code I use:
xincoTable.addItem(new Object[]{header, header.equals("URL") ? new Link(value,
new ExternalResource(value)) : value}, i++);
value has the actual URL string. I saw the tutorial but it uses generated columns so I'm not sure on how to pull it out. I guess part of the issue is that the behavior is desired for only that cell in that case, it'll be text in all other cases and of course there are other stuff in that columns in other rows as well.
Any idea?
Upvotes: 2
Views: 3405
Reputation: 4967
Your problem is that the type of the column containing Link is String. The type of the column should be Component:
table.addContainerProperty("mylinkproperty", Component.class, null);
And then set the value of your property to Link or Label instead of Link or String.
Upvotes: 5