[Users] Sub-Nodes on a Tree

Pou Pou pouniok at hotmail.com
Wed Jan 18 10:33:26 CET 2012


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 :


var treeConfig = [{
         	 text: 'Group 1', 
         	 nodeType: 'gx_overlaylayercontainer',
              expanded: true,
              loader: new GeoExt.tree.LayerLoader({
         		   filter: function(record) {
         		            return (record.getLayer().displayInLayerSwitcher == true)  && (record.getLayer().group == 'group1');
         		    }
         	 })
	        }, {
   text: 'Group 2',
              nodeType: 'gx_overlaylayercontainer',
              expanded: true,
              loader: new GeoExt.tree.LayerLoader({
         		   filter: function(record) {
         		         return (record.getLayer().displayInLayerSwitcher == true) && (record.getLayer().group == 'group2');
         		   }
         	 })
}];


var layerTree = new Ext.tree.TreePanel({

autoScroll: true,
enableDD: true,
rootVisible: false,
		        root: {
 	             nodeType: "async",
 	             expanded: true,
 	             children: treeConfig
		        },
 	         loader: new Ext.tree.TreeLoader({
 	                 applyLoader: false
});

Date: Tue, 17 Jan 2012 17:56:52 +0100
From: cowaboonger at gmail.com
To: users at geoext.org
Subject: [Users] Sub-Nodes on a Tree

Hello everyone!

I'm back with a question...

I'm building a tree with some groups and several layers for each as child nodes...

The thing is I read and construct the layers from a database...


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...

Anyone have an example?


Thank you very much in advance!

Regards!


_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120118/a53300e0/attachment.htm 


More information about the Users mailing list