Extjs4 使用ExtJS面板上下文菜单取消选择Javascript窗口选择
如果在选择文本后在ExtJS面板上显示ExtJS上下文菜单,它会隐藏或取消选择文本选择或窗口选择。当显示关联菜单时,如何保留所选内容Extjs4 使用ExtJS面板上下文菜单取消选择Javascript窗口选择,extjs4,extjs4.1,Extjs4,Extjs4.1,如果在选择文本后在ExtJS面板上显示ExtJS上下文菜单,它会隐藏或取消选择文本选择或窗口选择。当显示关联菜单时,如何保留所选内容 listeners: { afterrender: function(comp) { comp.getEl().on('contextmenu', function(e,src) { //stop default browser context menu appearing e.stopEve
listeners: {
afterrender: function(comp) {
comp.getEl().on('contextmenu', function(e,src) {
//stop default browser context menu appearing
e.stopEvent();
contextMenu = new Ext.menu.Menu({
items: [{
text: "Show On Map",
iconCls: 'map',
handler: function(a,b,c) {
alert(this.id);
}
}]
});
contextMenu.showAt([e.getPageX(),e.getPageY()]);
});
}
}
var contextMenu = Ext.create('Ext.menu.Menu', {
items: [{
id:'zoom',
text: 'Zoom in',
layout: {
align: 'left'
},
handler: function() {
alert('You clicked the Zoom in button!');
}
},
{
text: 'Zoom out',
align: 'left'
},
{
text: 'Add Marker',
align: 'left'
}
]
});
map.div.oncontextmenu = function noContextMenu(e) {
if (OpenLayers.Event.isRightClick(e)){
contextMenu.showAt(e);
}
return false; //cancel the right click of brower
};