I attached the ContextMenu to an Image (tried other components too) that is inside an inner window, and the popup doesn’t show.
Already tried in components outside the window, it works fine.
Cool addon, but submenus are opened in wrong position when the page is scrolled. You should take into account the scrolled pixels when you calculate the top position in the client side of the addon
Just to note that im having same issue as Joao Eduardo Galli, context menu doest show if used in sub-window.
Also css is messed up with vaadin 7.4 and valo theme.
I found a solution for my problem. I opened the context menu via
ContextMenue.open( x, y ) , whereat x and y are the actual coodinates of the mouse cursor. If I manipulate the coordinates a little bit in that way
ContextMenue.open( x+1, y+1 ) everything works as it should and the end user does not see the “missplaced” contextmenu.
But why it works I have really no idea.
I’m basically trying to get the selected ContextMenuItem but I always come up with null. Here is my code:
ContextMenu contextMenu = new ContextMenu();
contextMenu.setAsContextMenuOf(layout);
contextMenu.addItem("item1");
contextMenu.addItem("item2");
contextMenu.addItemClickListener(new ContextMenuItemClickListener()
{
@Override
public void contextMenuItemClicked(ContextMenuItemClickEvent event)
{
ContextMenu.ContextMenuItem clickedItem = (ContextMenu.ContextMenuItem)event.getSource();
System.out.println("Clicked Item: " + clickedItem.getData());
}
});
I'm basically trying to get the ContextMenuItem so that I can add an icon when it's clicked, as well as know which menu item was clicked.
Any suggestions on how to get the clicked ContextMenuItem would be appreciated.
we have just added ContextMenu to our project and observe strange behavior.
We have a multi-level menu, and all levels behave ok, with the exception that nested menu items drift more and more to the right with every new menu invocation.
If we open the page source in Firefox Inspector, we see something like this:
You should use the official
Vaadin ContextMenu Add-On for that purpose. The downside is that it requires Vaadin 7.6+ but it does work with Grid. There’s an example in their demo. The upside is that said add-on is likely to become part of Vaadin core at some point.
Scott, I appreciate your frustration but I’m guessing that this add-on has done an excellent job for many, many years. However, nowadays, and with Vaadin 7.6+, I would look to the semi-official
Vaadin ContextMenu Add-On as an alternative.
Hi,
I have a problem with the context menu. I’m using Vaadin 6 and ContextMenu 3.1.
I’d like that people who use my application can change the background color.
I have defined a default color in the style file as a variable :
I implemented ContextMenu in my application and it works fine, except it does not hide at times as it should, allowing the user to produce errors, like deleted the same row twice and the app gets a null pointer error. Could you please help with an indication as to get it to hide properly ?
The idea of Henri sounds very good indeed. I conducted a requested feature in version 2.1 and is now available. I also checked to make sure it will fit on the menu screen. If it does not, it will be open from the left click. It also works with submenus.