[Commits] r1570 - core/trunk/geoext/examples

commits at geoext.org commits at geoext.org
Tue Dec 8 16:15:00 CET 2009


Author: ahocevar
Date: 2009-12-08 16:15:00 +0100 (Tue, 08 Dec 2009)
New Revision: 1570

Modified:
   core/trunk/geoext/examples/tree.js
Log:
simplified example: register radiochange listener on the tree instead of every node.

Modified: core/trunk/geoext/examples/tree.js
===================================================================
--- core/trunk/geoext/examples/tree.js	2009-12-08 12:24:31 UTC (rev 1569)
+++ core/trunk/geoext/examples/tree.js	2009-12-08 15:15:00 UTC (rev 1570)
@@ -105,9 +105,7 @@
         nodeType: "gx_overlaylayercontainer",
         expanded: true,
         // render the nodes inside this container with a radio button,
-        // and assign them the group "foo". See the registerRadio function
-        // in the code that we use as handlers for the tree's insert and
-        // append events to make these radio buttons change the active layer.
+        // and assign them the group "foo".
         loader: {
             baseAttrs: {
                 radioGroup: "foo",
@@ -126,16 +124,6 @@
         }
     }], true);
 
-    // the layer node's radio button with its radiochange event can be used
-    // to set an active layer.
-    var registerRadio = function(node){
-        if(!node.hasListener("radiochange")) {
-            node.on("radiochange", function(node){
-                alert(node.layer.name + " is now the the active layer.");
-            });
-        }
-    }
-    
     // create the tree with the configuration from above
     var tree = new Ext.tree.TreePanel({
         border: true,
@@ -162,8 +150,9 @@
             children: Ext.decode(treeConfig)
         },
         listeners: {
-            "insert": registerRadio,
-            "append": registerRadio
+            "radiochange": function(node){
+                alert(node.layer.name + " is now the the active layer.");
+            }
         },
         rootVisible: false,
         lines: false,



More information about the Commits mailing list