直到6.2,在网格上下文菜单做显示菜单在上下文菜单的ExtJS
itemcontextmenu: function (a,b,c,d, e) {
contextmenu.showAt(e.getXY());
}
但随着6.5工作得很好,菜单不显示在给定的XY坐标如果菜单显示在上下文菜单之外。我在下面列出了一个例子。任何人看到这个问题?我尝试打开动画选项,但是菜单不会在面板内进行约束,所以当您在网格的底部点击右键时,菜单将显示在面板下方的底部。
任何输入的高度赞赏
工作实例
右键单击任何网格行
上下文菜单显示了您点击。
非工作示例
点击菜单按钮(菜单显示按钮的下方)
右击任何网格行
上下文菜单显示它在菜单按钮下方显示的位置,而不是您点击的位置。
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: '[email protected]', phone: '555-111-1224' },
{ name: 'Bart', email: '[email protected]', phone: '555-222-1234' },
{ name: 'Homer', email: '[email protected]', phone: '555-222-1244' },
{ name: 'Marge', email: '[email protected]', 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());
}
}
});
这将破坏第一场演出的菜单。如果用户想要再次显示菜单,会发生什么情况? –
@EvanTrimboli当菜单在2秒后隐藏时它会销毁 –
正确,这意味着它不能再次使用。 –