[Commits] r398 - apps/opengeo/geoexplorer/trunk/lib

commits at geoext.org commits at geoext.org
Wed Apr 15 21:14:03 CEST 2009


Author: sbenthall
Date: 2009-04-15 21:14:03 +0200 (Wed, 15 Apr 2009)
New Revision: 398

Modified:
   apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
Log:
adding a functional Remove Layer item to the context menu for nodes on the layer tree


Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-15 07:49:20 UTC (rev 397)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-15 19:14:03 UTC (rev 398)
@@ -164,7 +164,34 @@
                     text: 'Map Layers',
                     layerStore: this.layers
                 }),
-                enableDD: true
+                enableDD: true,
+                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: [{
+                        id: 'remove-layer',
+                        text: 'Remove Layer'
+                    }],
+                    listeners: {
+                        itemclick: function(item){
+                            switch (item.id) {
+                            case 'remove-layer':
+                                cn = this.contextNode;
+                                cn.layerStore.removeAt(cn.layerStore.findBy(function(record){
+                                    return record.get("layer") == cn.layer;
+                                }));
+                                break;
+                            }   
+                        }
+                    }
+                })
             }],
             tbar: [new Ext.Button({
                 text : "Add Layers",
@@ -476,10 +503,9 @@
         var toolGroup = "toolGroup";
         var tools = [
             new Ext.Button({
-                tooltip: "Bookmark",
-                iconCls: "icon-save",
                 handler: this.bookmark,
-                scope: this
+                scope: this,
+                iconCls: "icon-save"
             }),
             "|"
             ,



More information about the Commits mailing list