私は2つのタブパネルを作成し、各パネルにはグリッドがあります。Extjs 3 rowcontext destroy
グリッドAのためのリスナー:グリッドBのための
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);
});
リスナー:
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メニューを右クリックではありません働く(小さな灰色の点が表示されます)。
私は戻ってグリッドAと右クリックに回した後、それはグリッドA上の2つのrowcontextのメニューを示しています。私は右のBグリッドとグリッドを右クリックしをクリックした場合
を(何も示していない)の後Bグリッドに戻る グリッドBに2つのリスト(逆順)を含むrowcontextメニューを表示します。
なぜこのようなことが起こりますか?
グリッド行の各コンテキストメニューを正しく表示するにはどうすればよいですか?
このパラメータは、インライン関数で使用しています。それは問題ではない – ShootingStar