我创建了两个选项卡面板,每个面板都有一个网格。Extjs 3 rowcontext destroy
监听网格答:
Ext.getCmp('AGrid').addListener("rowcontextmenu", function menus(grid, rowIndex, e) {
if (!grid.contextMenu) {
grid.contextMenu = new Ext.menu.Menu({
autoDestroy: false,
items: [{ id: 'view', text: 'View Content'}],
currentRowIndex: rowIndex,
listeners: {
itemclick: function (item) {
switch (item.id) {
case 'view':
viewEmailClick(grid.getStore().getAt(this.currentRowIndex).data);
break;
}
}
}
});
}
this.contextMenu.currentRowIndex = rowIndex;
e.stopEvent(); // this stops the browser context menu and allows the default grid
// show the row context menu here
this.contextMenu.showAt(e.xy);
});
监听网格B:
Ext.getCmp('BGrid').addListener("rowcontextmenu", function menus(grid, rowIndex, e) {
if (!grid.contextMenu) {
grid.contextMenu = new Ext.menu.Menu({
autoDestroy: false,
items: [{ id: 'view', text: 'View Task'}],
currentRowIndex: rowIndex,
listeners: {
itemclick: function (item) {
switch (item.id) {
case 'view':
viewTicketClick(grid.getStore().getAt(this.currentRowIndex).data);
break;
}
}
}
});
}
this.contextMenu.currentRowIndex = rowIndex;
e.stopEvent(); // this stops the browser context menu and allows the default grid
// show the row context menu here
this.contextMenu.showAt(e.xy);
});
我用鼠标右键点击它,电网A工作正常,然后用鼠标右键单击电网B rowcontext菜单上不工作(只显示小灰点)。
后,我回头电网和右侧点击,它显示网格的两个rowcontext菜单:
如果我在B方格纹点击右键,网格右击后(没有任何显示)回到B格 它显示rowcontext菜单,其中包含两个列表(相反的顺序)在网格B上。
为什么会发生这种事情?
如何正确显示每个网格行上下文菜单?
该参数在内联函数中使用。这不是问题 – ShootingStar 2012-01-30 22:11:35