Up until 6.2, context menu on a grid worked fine by doing
itemcontextmenu: function (a,b,c,d, e) {
contextmenu.showAt(e.getXY());
}
But with 6.5, the menu doesn't show at the given XY coordinate if the menu is shown outside of the context menu. I have included an example below. Anyone seen this issue? I have tried turning on the animation option too, but the menu doesn't constrain within the panel, so when you right click at the bottom of the grid, the menu shows at the bottom below the panel.
Any input is highly appreciated
Working example
Right click on any grid row
Context Menu shows where you clicked.
Non-working example
Click on the Menu Button (menu shows below the button)
Right click on any grid row
Context menu shows where it was displayed below Menu Button instead of where you clicked.
var mymenu = new Ext.menu.Menu({
items: [
// these will render as dropdown menu items when the arrow is clicked:
{text: 'Item 1', handler: function(){ alert("Item 1 clicked"); }},
{text: 'Item 2', handler: function(){ alert("Item 2 clicked"); }}
]
});
Ext.create('Ext.button.Split', {
renderTo: Ext.getBody(),
text: 'Menu Button',
menu: mymenu
});
Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields:[ 'name', 'email', 'phone'],
data: [
{ name: 'Lisa', email: 'lisa@simpsons.com', phone: '555-111-1224' },
{ name: 'Bart', email: 'bart@simpsons.com', phone: '555-222-1234' },
{ name: 'Homer', email: 'homer@simpsons.com', phone: '555-222-1244' },
{ name: 'Marge', email: 'marge@simpsons.com', phone: '555-222-1254' }
]
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody(),
listeners: {
scope: this,
itemcontextmenu: function (a,b,c,d,e){
e.stopEvent();
mymenu.showAt(e.getXY());
}
}
});