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

commits at geoext.org commits at geoext.org
Wed Dec 1 09:46:31 CET 2010


Author: ahocevar
Date: 2010-12-01 09:46:31 +0100 (Wed, 01 Dec 2010)
New Revision: 2505

Modified:
   core/trunk/geoext/examples/tree.js
Log:
make it clear that the json encoding/decoding is not intended for use in applications.


Modified: core/trunk/geoext/examples/tree.js
===================================================================
--- core/trunk/geoext/examples/tree.js	2010-11-29 20:12:46 UTC (rev 2504)
+++ core/trunk/geoext/examples/tree.js	2010-12-01 08:46:31 UTC (rev 2505)
@@ -97,7 +97,7 @@
         
     // using OpenLayers.Format.JSON to create a nice formatted string of the
     // configuration for editing it in the UI
-    var treeConfig = new OpenLayers.Format.JSON().write([{
+    var treeConfig = [{
         nodeType: "gx_baselayercontainer"
     }, {
         nodeType: "gx_overlaylayercontainer",
@@ -120,7 +120,11 @@
         loader: {
             param: "LAYERS"
         }
-    }], true);
+    }];
+    // the line below is only needed for this example, because we want to allow
+    // interactive modifications of the tree configuration. Don't use this line
+    // in your code.
+    treeConfig = new OpenLayers.Format.JSON().write(treeConfig, true);
 
     // create the tree with the configuration from above
     tree = new Ext.tree.TreePanel({
@@ -155,6 +159,9 @@
             // provide an initial set of layer nodes. We use the treeConfig
             // from above, that we created with OpenLayers.Format.JSON.write.
             children: Ext.decode(treeConfig)
+            // Don't use the line above in your application. Instead, use
+            //children: treeConfig
+            
         },
         listeners: {
             "radiochange": function(node){



More information about the Commits mailing list