<HTML><HEAD>
<STYLE type=text/css><!-- DIV {margin:0px;} --></STYLE>
</HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">
<DIV>This is actually really easy Robert.</DIV>
<DIV>You need to implement the ‘filter’ function of the LayerLoader so that
layers are grouped properly</DIV>
<DIV>Here is the simplest but also most manual way to go about it.</DIV>
<DIV>Assumptions: each layer has a ‘division’ attribute of the format “X.X” and
the layer store is configured to read that attribute</DIV>
<DIV>{</DIV>
<DIV>//... Tree Panel config ...</DIV>
<DIV>root: {</DIV>
<DIV> nodeType: 'async',</DIV>
<DIV> children: [{</DIV>
<DIV> nodeType:
"gx_baselayercontainer",</DIV>
<DIV> text: 'BaseLayersDir'</DIV>
<DIV> }, {</DIV>
<DIV> nodeType:
"gx_overlaylayercontainer",</DIV>
<DIV> expanded: true,</DIV>
<DIV> title: 'Dir 1',</DIV>
<DIV> loader: {</DIV>
<DIV> filter:
function(rec){</DIV>
<DIV>
var div = rec.get('division');</DIV>
<DIV>
return div.split('.')[0] == 1;</DIV>
<DIV> }</DIV>
<DIV> }</DIV>
<DIV> }, {</DIV>
<DIV> nodeType:
"gx_overlaylayercontainer",</DIV>
<DIV> expanded: true,</DIV>
<DIV> title: 'Dir 2',</DIV>
<DIV> loader: {</DIV>
<DIV> filter:
function(rec){</DIV>
<DIV>
var div = rec.get('division');</DIV>
<DIV>
return div.split('.')[0] == 2;</DIV>
<DIV> }</DIV>
<DIV> }</DIV>
<DIV> }, {</DIV>
<DIV> nodeType:
"gx_overlaylayercontainer",</DIV>
<DIV> expanded: true,</DIV>
<DIV> title: 'Dir 3',</DIV>
<DIV> loader: {</DIV>
<DIV> filter:
function(rec){</DIV>
<DIV>
var div = rec.get('division');</DIV>
<DIV>
return div.split('.')[0] == 3;</DIV>
<DIV> }</DIV>
<DIV> }</DIV>
<DIV> }]</DIV>
<DIV>},</DIV>
<DIV>....More Tree Panel Config</DIV>
<DIV>}</DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>There are other more automated ways to go about it.
However, this should get you started.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>One word of caution, if you try to do some more fancy
stuff and want to use a loader with native ExtJS nodeType, then you must provide
loader with an actual loader instance and NOT just the configuration for the
loader. Only ‘gx_layercontainer’ and its subclass nodeTypes will automatically
instantiate the loader for you from config. Other nodeTypes will ignore it if it
is not already an instance.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">Matt
Priour<BR>Kestrel Computer Consulting</DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=robertdbuckley@yahoo.com
href="mailto:robertdbuckley@yahoo.com">Robert Buckley</A> </DIV>
<DIV><B>Sent:</B> Wednesday, August 10, 2011 3:59 AM</DIV>
<DIV><B>To:</B> <A title=users@geoext.org
href="mailto:users@geoext.org">users@geoext.org</A> </DIV>
<DIV><B>Subject:</B> [Users] Tree advice</DIV></DIV></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: #000000; FONT-SIZE: 10pt">
<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV>I want to know how to create a geoext layer tree....but the "right"
way!</DIV>
<DIV> </DIV>
<DIV>I have seen examples such as here in the Haiiti Map ("<A
href="http://hypercube.telascience.org/haiti/">http://hypercube.telascience.org/haiti/</A>")
where multiple stores are created to group the layers together and then add them
as nodes to the tree root.</DIV>
<DIV> </DIV>
<DIV>However, although this works, Mr Andreas Hocevar has written this regarding
a similar topic regarding creating a hierarchical tree structure...."What you
want is easy to do. Just get rid of the multiple layer stores. There are in fact
many ways to do what you want. What I have done previously, for example, is to
have layer nodes with a "group" field, and set the filter of the LayerLoader of
each LayerContainer to only accept layer records that match a specific group
name."</DIV>
<DIV> </DIV>
<DIV>I take his word as gospel, and therefore would like to know (possibly with
a few code examples if anyone has any) what is the best way to achieve a nested
tree structure with Directories in Directories which contain layers such as in
the following diagram</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Root > BaselayersDir</DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>BaseLayer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>BaseLayer
2</DIV></DIV>
<DIV><SPAN class=Apple-style-span>
> </SPAN>Dir<SPAN class=Apple-style-span>1</SPAN></DIV>
<DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>1:1</SPAN></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>1:1</SPAN></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>1:2</SPAN></DIV></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV>
<DIV><SPAN class=Apple-style-span>
> </SPAN>Dir<SPAN class=Apple-style-span>2</SPAN></DIV></DIV>
<DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>2:1</SPAN></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>2:1</SPAN></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>2:2</SPAN></DIV></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV>
<DIV><SPAN class=Apple-style-span>
> </SPAN>Dir<SPAN class=Apple-style-span>3</SPAN></DIV></DIV>
<DIV>
<DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>3:1</SPAN></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>3:1</SPAN></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV><SPAN class=Apple-style-span><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>></SPAN>Dir<SPAN
class=Apple-style-span>3:2</SPAN></DIV></DIV></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
1</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>>Layer
2</DIV></DIV>
<DIV>
<DIV> </DIV></DIV>
<DIV> </DIV>
<DIV>How many way can one achieve this then? and what is a good method and what
is a bad one?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thanks for any advice,</DIV>
<DIV> </DIV>
<DIV>Rob </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV style="POSITION: fixed"></DIV></DIV>
<P>
<HR>
_______________________________________________<BR>Users mailing
list<BR>Users@geoext.org<BR>http://www.geoext.org/cgi-bin/mailman/listinfo/users<BR></DIV></DIV></DIV></BODY></HTML>