table right click handler retrieve cell

Hello,

I was able to get a right-click handler working on the table I am working on, thanks to the excellent Vaadin docs and samples.

However I have been trying to determine which cell in the table the right click was performed on without luck. It seems that all the objects in the row are returned by the handler.

Is there anyway to retrieve the cell that the right-click was performed on in the table?

Thank you.

You can use ItemClicklister to get the clicked itemId and propertyId:

table.addListener(new ItemClickListener() {
	public void itemClick(ItemClickEvent event) {
		if (event.getButton() == ClickEvent.BUTTON_RIGHT) {
			System.out.println("itemId: " + event.getItemId());
			System.out.println("propertyId: " + event.getPropertyId());
		}
	}
});	

Great! Thank you.

In vaadin 7, just simple use table.addItemClickListener
ex:


		table.addItemClickListener(new ItemClickListener() {
			@Override
			public void itemClick(ItemClickEvent event) {
				if (event.getButton() != MouseButton.RIGHT)
					return;
				// do something
			}
		});