<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Luis,<br>
    <br>
    I think you mixed up two things: instead of using a direct
    instanciation of the GeoExt.tree.LayerContainer AND giving an
    nodeType
    in both cases you should use a declaration with only a nodeType like
    this<br>
    <br>
    <tt>var baseLayerList = {<br>
      &nbsp;&nbsp;&nbsp; "nodeType": "gx_baselayercontainer"<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>
      };</tt><br>
    <br>
    The same with the overlay container.<br>
    <br>
    <br>
    The things with the "additional node in the tree without a name":&nbsp;
    This is the so called root node. By giving your TreePanel instance
    the config option
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; word-wrap: break-word; white-space: pre-wrap;">rootVisible: false

</pre>
    the root folder could be hidden.<br>
    <br>
    More infos could be found here: <br>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a
      href="http://geoext.org/lib/GeoExt/widgets/tree/BaseLayerContainer.html">http://geoext.org/lib/GeoExt/widgets/tree/BaseLayerContainer.html</a><br>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a
href="http://geoext.org/lib/GeoExt/widgets/tree/OverlayLayerContainer.html">http://geoext.org/lib/GeoExt/widgets/tree/OverlayLayerContainer.html</a><br>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a href="http://api.geoext.org/1.1/examples/tree.html">http://api.geoext.org/1.1/examples/tree.html</a><br>
    <br>
    <br>
    <br>
    Best regards,<br>
    Chris<br>
    <br>
    <br>
    <br>
    On 14.03.2012 16:12, Lu&iacute;s de Sousa wrote:
    <blockquote
cite="mid:CAEtdG7sHrecEgRMA=FMUPu5myAP+RE3E47GHsa3Tt1cmg_=hkw@mail.gmail.com"
      type="cite">
      <pre wrap="">Dear all,

I'm trying to code a layer tree with two containers: one for base
layers and another for overlays. Using the code that goes below I'm
getting two containers but both are listing all the layers. Besides
this, the containers are listed inside an additional node in the three
without a name. What am I doing wrong?

Thank you for the help,

Lu&iacute;s

######################################################################

var baseLayerList = new GeoExt.tree.LayerContainer({
            text: 'Base Layers',
            layerStore: mapPanel.layers,
            leaf: false,
            expanded: true,
            nodeType:'gx_baselayercontainer',
        });
        
        var overlayList = new GeoExt.tree.LayerContainer({
            text: 'Overlays',
            layerStore: mapPanel.layers,
            expanded: true,
            nodeType:'gx_overlaylayercontainer',
        });
        
        var treeRoot = new Ext.tree.AsyncTreeNode({
        expanded: true,
        children: [
            baseLayerList,
            overlayList
        ]
      });
        
        var layerTree = new Ext.tree.TreePanel({
            title: 'Map Layers',
            root: treeRoot,
            region: "east",
            width: 170,
        collapsible: true,
        autoScroll: true,
        enableDD: true,
        });
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@geoext.org">Users@geoext.org</a>
<a class="moz-txt-link-freetext" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>