Example of context menu with a treepanel
03/16/09 12:07 PM
I was able to get a context menu working by wrapping the following code within an <ext:treepanel> tag. Here's the code I used:
<ext:listener eventName="contextmenu"> function(node, e){ e.stopEvent(); node.select(); var mainContextMenu = new Ext.menu.Menu('mainContext'); mainContextMenu.add( new Ext.menu.Item({text:'Edit Article', iconCls:'icon-edit', handler:editPage}), new Ext.menu.Item({text:'Delete Article', iconCls:'icon-cross', handler:deletePage}), new Ext.menu.Separator(), new Ext.menu.Item({text:'Add New Article', iconCls:'icon-add', handler:addPage}) ); mainContextMenu.showAt(e.getXY()); } </ext:listener>