Hi,
I've added a context menu to my TileGrid to allow the user to perform an action on the relevant record when selecting the menu item. I was pouring over the documentation and I could not find a way to get the tile record the context menu was launched from, when in the context handler. The other option I was pondering about was adding a right click listener to each tile, but it seems inefficient to me.
The snippet of the code is:
I'm using SmartGWT 2.2 with GWT 2.0.3 running on Windows XP SP3 32bit with Chrome 5.
Thanks for any suggestion.
-Gabriel
I've added a context menu to my TileGrid to allow the user to perform an action on the relevant record when selecting the menu item. I was pouring over the documentation and I could not find a way to get the tile record the context menu was launched from, when in the context handler. The other option I was pondering about was adding a right click listener to each tile, but it seems inefficient to me.
The snippet of the code is:
Code:
Menu galleryMenu=new Menu();
MenuItem selectImageMenuItem=new MenuItem("Select Image");
galleryMenu.addItem(selectImageMenuItem);
selectImageMenuItem.addClickHandler(new ClickHandler()
{
@Override
public void onClick(MenuItemClickEvent event)
{
// Could not find a way to get to the clicked record
// from here. Could not rely on get selected, since
// a right click record is not necessarily previously
// selected. So the line below does not solve the issue.
chooseImage(galleryGrid.getSelectedRecord());
System.out.println(event.toDebugString());
}
});
galleryGrid.setContextMenu(galleryMenu);
Thanks for any suggestion.
-Gabriel
Comment