There are itemcontextmenu
and containercontextmenu
events in Ext.tree.Panel
.
Update: same events exist for Ext.grid.Panel. You probably want to subscribe for both of them and do something like that:
showContextMenu: function(e) {
var me = this;
if (me.contextMenu === undefined)
return;
e.stopEvent();
me.contextMenu.showAt(e.getXY());
},
// Show context menu from the grid
gridContextMenu: function(view, rec, node, index, e) {
this.showContextMenu(e);
},
// Show context menu from the empty area below grid records
containerContextMenu: function(view, e) {
this.showContextMenu(e);
},