<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
To do that, I added a "group" property in my layer's javascript object. This way, you can group your layers using this property in the loader :<BR><br><BR>var treeConfig = [{<br>          text: 'Group 1', <br>          nodeType: 'gx_overlaylayercontainer',<br> expanded: true,<br> loader: new GeoExt.tree.LayerLoader({<br>                  filter: function(record) {<br>                  return (record.getLayer().displayInLayerSwitcher == true) && (record.getLayer().group == 'group1');<br>                  }<br>          })<br>         }, {<br> text: 'Group 2',<br> nodeType: 'gx_overlaylayercontainer',<br> expanded: true,<br> loader: new GeoExt.tree.LayerLoader({<br>                  filter: function(record) {<br>                  return (record.getLayer().displayInLayerSwitcher == true) && (record.getLayer().group == 'group2');<br>                  }<br>          })<br>}];<BR><br><BR>var layerTree = new Ext.tree.TreePanel({<br><BR>autoScroll: true,<br>enableDD: true,<br>rootVisible: false,<br>                 root: {<br>          nodeType: "async",<br>          expanded: true,<br>          children: treeConfig<br>                 },<br>          loader: new Ext.tree.TreeLoader({<br>          applyLoader: false<br>});<br><br><div><hr id="stopSpelling">Date: Tue, 17 Jan 2012 17:56:52 +0100<br>From: cowaboonger@gmail.com<br>To: users@geoext.org<br>Subject: [Users] Sub-Nodes on a Tree<br><br>Hello everyone!<br><br>I'm back with a question...<br><br>I'm building a tree with some groups and several layers for each as child nodes...<br><br>The thing is I read and construct the layers from a database...<br>
<br>building it with all as parent nodes is easy, ok, but the hard thing (at least for me) is figuring out how to create that groups, and appending layers as child in the corresponding group...<br><br>Anyone have an example?<br>
<br>Thank you very much in advance!<br><br>Regards!<br>
<br>_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users</div>                                            </div></body>
</html>