Grid (14.2) open context menu via Kebab button

B"H

Hi,

I am trying to add a column that will be a kebab column for grid.

was not able to delegate the click to be a right click on the grid (or other way to open the menu)

any idea?

	private class GridTableKebabProvider<T, V> implements ValueProvider<T, V>{

		@Override
		public V apply(T source) {
			Button kebab = new Button(extendFontIcon.getFont("CONTEXTMENU"));
			kebab.addClickListener(new ComponentEventListener<ClickEvent<Button>>() {
				
				@Override
				public void onComponentEvent(ClickEvent<Button> event) {
					if(event.getButton() == 3){
						return;
					}//activate right click to native menu
					grid.fireEvent(new ClickEvent(kebab, true,
				    		event.getScreenX(),
				    		event.getScreenY(),
				    		event.getClientX(),
				    		event.getClientY(),
				            1,
				            3,
				            false,false,false,false
				     ));
				}
			});
			return (V) kebab;
		}
		
	}

I don’t think you can make a ClickEvent be a right-click. Click Events are only meant to be for left clicks IIRC.

If you want to open a context menu upon clicking that button, you could use Vaadins [ContextMenu]
(https://vaadin.com/components/vaadin-context-menu/java-examples), and even have complete control over what options are shown in that menu.

B"H

Hi,

Anyway i have options while using GridContextMenu.

Has to be some way to call the relevant event…

Also, if i will use Button and ContextMenu, i will need to do it in addition to GridContextMenu

our UX expert want same availability from kebab and right click, and it does make sense