View Full Version : Set property on Events.ContextMenu

1 Dec 2011, 7:06 AM

I need different ContextMenus on every column of a Grid. To change the context menu content I have a listener on the grid:

grid.addListener(Events.Contextmenu, new ContextMenuListener());

The listener gets now GridEvents (as documented):

private class ContextMenuListener implements Listener<GridEvent<ModelData>> {

public void handleEvent(GridEvent<ModelData> evt) {
// change the content of the menu

What I need is the property name of the column, where the menu has been opened. I can use the following:

String property = evt.getGrid().getColumnModel().getColumn(evt.getColIndex()).getId();

The GridEvent has already a method getProperty(), but it returns null. Can you change this in the next version?
It would simplify the code on that point. The colIndex is not documented for the event, so I also use an undocumented feature here...