Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Table - image on context menu
Hi,
Is there a way in vaadin to put images in the context menu for table.
I searched everywhere but could not find the answer.
Thanks in advances.
The context menu Actions can have an icon.
If you need more flexibility, you could also make a custom context menu, perhaps by having a click listener for the table (or an item) that handles right-clicks. It could open a ContextMenu component (from an add-on), for example.
Thnx man, i didnt know you could set an icon to an action...
Marko Grönroos: The context menu Actions can have an icon.
If you need more flexibility, you could also make a custom context menu, perhaps by having a click listener for the table (or an item) that handles right-clicks. It could open a ContextMenu component (from an add-on), for example.
Table t = new Table();
final ContextMenu menu = new ContextMenu();
menu.addItem("Click me!");
table.addListener(new ItemClickEvent.ItemClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void itemClick(ItemClickEvent event) {
if(event.getButton() == ItemClickEvent.BUTTON_RIGHT)
menu.show(event.getClientX(), event.getClientY());
}
});
Does not work, see reply from Peter Lehto.
https://vaadin.com/forum/-/message_boards/view_message/393775#_19_message_971221
table.refreshRowCache(); on table ValueChangeListener triggers unnecessary re-querying of data.
If you could present a workaround for updating the available table item actions, that would be great.
Edit: managed to get it to work, see:
https://vaadin.com/forum/-/message_boards/view_message/1161377#_19_message_1273005