Hi Viola, yes..it took a while for me too.
In my example the tree nodes hold the context menu... In my example underneath, I have a context menu holding a "Zoom to Layer Extent" button and the Metadata window. A test version is here http://maps.zgb.de/www/zgb_energie/geodatenportal.html It could probably do with some tweaking though. For some reason the layers added dynamically to the tree could never be queried. I wrote many threads, but no-one was able to say why. Anyway, hope it helps with your endeavors. var layerTree = new Ext.tree.TreePanel({...etc listeners: { contextmenu: function (node, e) { node.select(); var c = node.getOwnerTree().contextMenu; c.contextNode = node; c.showAt(e.getXY()) }, scope: this }, contextMenu: new Ext.menu.Menu({ items: [{ text: "Zoom to Layer Extent", icon: '../images/arrow_out.png', handler: function () { var node = layerTree.getSelectionModel().getSelectedNode(); if (node && node.layer) { this.map.zoomToExtent(node.layer.maxExtent) } }, scope: this }, { text: "Metadata", icon: '../images/grid.png', handler: function () { if (!winContext) { var node = layerTree.getSelectionModel().getSelectedNode(); var layername = node.text; var winContext = new Ext.Window({ title: '<span style="color:#00; font-weight:bold;">Metadaten: </span>' + layername, layout: 'fit', text: layername, width: 800, height: 500, closeAction: 'hide', plain: true, items: [tabsMetadata], buttons: [{ text: 'Schließen', handler: function () { winContext.hide() } }] }) } winContext.show(this) }, scope: this }, removeLayerAction, { text: "Zusatzlayer hinzufügen", icon: '../images/add.png', handler: function () { if (!capabiltieswin) { capabiltieswin = new Ext.Window({ title: "WMS Layer hinzufügen", layout: 'fit', width: '600', height: 'auto', border: false, closable: true, collapsible: true, x: 450, y: 100, resizable: true, closeAction: 'hide', plain: true, tbar: [tabsMetadata] }) } capabiltieswin.show(this) } }] }) }); ________________________________ Von: Viola Anne <violaa...@gmail.com> An: robertdbuck...@yahoo.com Gesendet: Dienstag, den 2. August 2011, 16:24:00 Uhr Betreff: Context menu on right click -GEOEXT Hi Robert, Stumbled upon your question regarding context menu on right click, I have searched the mailing lists but with no success. You asked the exact qusetion am trying to solve today. http://www.mail-archive.com/users@geoext.org/msg01203.html: I would like to achieve the same and am just wondering if you managed to get round this query. Any advice/help will be highly appreciated as I have been at it for some days now without any success. I qoute your question on the mailing list. I would like to add a rightclick context menu to each layer in the layer tree which does the >following. >1. Changes opacity of the layer >2. Offers metadata for that layer >3. Offers a download choice for that layer >4. Offers the ability to remove the layer Looking forward to your reply. -- Kind Regards, Viola
_______________________________________________ Users mailing list Users@geoext.org http://www.geoext.org/cgi-bin/mailman/listinfo/users