<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>&nbsp;                &nbsp;text: 'Group 1',&nbsp;<br>&nbsp;                &nbsp;nodeType: 'gx_overlaylayercontainer',<br>&nbsp;            &nbsp;expanded: true,<br>&nbsp;            &nbsp;loader: new GeoExt.tree.LayerLoader({<br>&nbsp;                        &nbsp; &nbsp;filter: function(record) {<br>&nbsp;                            &nbsp; &nbsp; &nbsp; &nbsp; return (record.getLayer().displayInLayerSwitcher == true) &nbsp;&amp;&amp; (record.getLayer().group == 'group1');<br>&nbsp;                        &nbsp; &nbsp; }<br>&nbsp;                &nbsp;})<br>                }, {<br>&nbsp; &nbsp;text: 'Group 2',<br>&nbsp;            &nbsp;nodeType: 'gx_overlaylayercontainer',<br>&nbsp;            &nbsp;expanded: true,<br>&nbsp;            &nbsp;loader: new GeoExt.tree.LayerLoader({<br>&nbsp;                        &nbsp; &nbsp;filter: function(record) {<br>&nbsp;                            &nbsp; &nbsp; &nbsp;return (record.getLayer().displayInLayerSwitcher == true) &amp;&amp; (record.getLayer().group == 'group2');<br>&nbsp;                        &nbsp; &nbsp;}<br>&nbsp;                &nbsp;})<br>}];<BR><br><BR>var layerTree = new Ext.tree.TreePanel({<br><BR>autoScroll: true,<br>enableDD: true,<br>rootVisible: false,<br>                        root: {<br>&nbsp;                    &nbsp;nodeType: "async",<br>&nbsp;                    &nbsp;expanded: true,<br>&nbsp;                    &nbsp;children: treeConfig<br>                        },<br>&nbsp;                &nbsp;loader: new Ext.tree.TreeLoader({<br>&nbsp;                    &nbsp; &nbsp; &nbsp;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>