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.
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
Action
s 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…
[code]
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());
}
});
[/code]
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