Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Different context menus for table columns
I'm would like to add a context menu to a table. Some columns should have a context menu, some not. I'm trying to use the Action.Handler-mechanism for this. I have two problems with this feature:
method allows me to return different actions per item/per row, but not per column. So all columns will get the same actions.
- From the parameters of the
method I can not tell, in which column the right click occured. Again, I get the row (parameter target) but not the column, so I can not identify the exact cell for which the user triggered the context menu action.
Am I missing something obvious? Is the Action.Handler not intended to be used in this way with a table?
I did not yet try it with the ContextMenu add-on because I thought that if a context menu on tables is already supported in Vaadin core, this functionality for handling each column separately should somehow be possible without an add-on.
I think the action handler is created only once at table initialization and reused afterwards.
I think I have read in the forum somewhere that calling table.requestRepaint() from the ValueChangeListener would force the action handler to be recreated at every selection change event, but I haven't tried.
Using the context menu add-on should makes things easier and less hackish for you.