1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
3 | |
---|
4 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
5 | <head> |
---|
6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
7 | |
---|
8 | <title>Layer Tree Tutorial — GeoExt v1.0</title> |
---|
9 | <link rel="stylesheet" href="../_static/geoext.css" type="text/css" /> |
---|
10 | <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> |
---|
11 | <script type="text/javascript"> |
---|
12 | var DOCUMENTATION_OPTIONS = { |
---|
13 | URL_ROOT: '../', |
---|
14 | VERSION: '1.0', |
---|
15 | COLLAPSE_MODINDEX: false, |
---|
16 | FILE_SUFFIX: '.html', |
---|
17 | HAS_SOURCE: true |
---|
18 | }; |
---|
19 | </script> |
---|
20 | <script type="text/javascript" src="../_static/jquery.js"></script> |
---|
21 | <script type="text/javascript" src="../_static/doctools.js"></script> |
---|
22 | <link rel="shortcut icon" href="../_static/favicon.ico"/> |
---|
23 | <link rel="top" title="GeoExt v1.0" href="../index.html" /> |
---|
24 | <link rel="up" title="Tutorials" href="index.html" /> |
---|
25 | <link rel="next" title="Map Tool Tutorial" href="control-button-tutorial.html" /> |
---|
26 | <link rel="prev" title="MapPanel Tutorial" href="mappanel-tutorial.html" /> |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | </head> |
---|
34 | <body> |
---|
35 | <div class="header"> |
---|
36 | <div class="wrap"> |
---|
37 | <h1 id="logo"><a href="../index.html">GeoExt</a></h1> |
---|
38 | <ul id="top-nav"> |
---|
39 | <li class="first"><a href="../docs.html">Documentation</a></li> |
---|
40 | <li><a href="../examples.html">Examples</a></li> |
---|
41 | <li><a href="../downloads.html">Download</a></li> |
---|
42 | <li><a href="http://trac.geoext.org/">Development</a></li> |
---|
43 | </ul> |
---|
44 | <div id="searchbox"> |
---|
45 | <form class="search" action="../search.html" method="get"> |
---|
46 | <input id="searchbox-query" type="text" name="q" size="25" value="Search …" tabindex="3" onblur="if(this.value=='') this.value='Search …';" onfocus="if(this.value=='Search …') this.value='';" /> |
---|
47 | <input id="searchbox-submit" type="image" value="Search" src="../_static/img/search_icon_green.png" /> |
---|
48 | <input type="hidden" name="check_keywords" value="yes" /> |
---|
49 | <input type="hidden" name="area" value="default" /> |
---|
50 | </form> |
---|
51 | </div> |
---|
52 | </div> |
---|
53 | </div> |
---|
54 | |
---|
55 | <div class="related"> |
---|
56 | <h3>Navigation</h3> |
---|
57 | <ul> |
---|
58 | <li><a href="../index.html">GeoExt</a> »</li> |
---|
59 | <li><a href="index.html" accesskey="U">Tutorials</a> »</li> |
---|
60 | <li><a href="#">Layer Tree Tutorial</a></li> |
---|
61 | </ul> |
---|
62 | </div> |
---|
63 | |
---|
64 | <div class="sphinxsidebar"> |
---|
65 | <div class="sphinxsidebarwrapper"> |
---|
66 | <h3><a href="../index.html">Table Of Contents</a></h3> |
---|
67 | <ul> |
---|
68 | <li><a class="reference external" href="#">Layer Tree Tutorial</a><ul> |
---|
69 | <li><a class="reference external" href="#start-with-a-map">Start With a Map</a></li> |
---|
70 | <li><a class="reference external" href="#filtering">Filtering</a></li> |
---|
71 | <li><a class="reference external" href="#visibility-grouping">Visibility Grouping</a></li> |
---|
72 | <li><a class="reference external" href="#layer-nodes-with-additional-radio-buttons">Layer Nodes with Additional Radio Buttons</a></li> |
---|
73 | <li><a class="reference external" href="#sub-layers">Sub-Layers</a></li> |
---|
74 | </ul> |
---|
75 | </li> |
---|
76 | </ul> |
---|
77 | |
---|
78 | <h4>Previous topic</h4> |
---|
79 | <p class="topless"><a href="mappanel-tutorial.html" |
---|
80 | title="previous chapter"><tt class="docutils literal"><span class="pre">MapPanel</span></tt> Tutorial</a></p> |
---|
81 | <h4>Next topic</h4> |
---|
82 | <p class="topless"><a href="control-button-tutorial.html" |
---|
83 | title="next chapter">Map Tool Tutorial</a></p> |
---|
84 | </div> |
---|
85 | </div> |
---|
86 | |
---|
87 | |
---|
88 | <div class="document"> |
---|
89 | <div class="documentwrapper"> |
---|
90 | <div class="bodywrapper"> |
---|
91 | <div class="body"> |
---|
92 | |
---|
93 | <div class="section" id="layer-tree-tutorial"> |
---|
94 | <h1>Layer Tree Tutorial<a class="headerlink" href="#layer-tree-tutorial" title="Permalink to this headline">¶</a></h1> |
---|
95 | <p>Often when presenting users with an interactive map, it is useful to allow them |
---|
96 | to control the visible layers. In this tutorial, we examine the use of |
---|
97 | <a title="GeoExt.tree.LayerContainer" class="reference external" href="../lib/GeoExt/widgets/tree/LayerContainer.html#GeoExt.tree.LayerContainer"><tt class="xref docutils literal"><span class="pre">GeoExt.tree.LayerContainer</span></tt></a> with the stock <tt class="docutils literal"><span class="pre">Ext.tree.TreePanel</span></tt> class |
---|
98 | to accommodate toggling visibility of layers and rearranging their drawing |
---|
99 | order.</p> |
---|
100 | <div class="admonition note"> |
---|
101 | <p class="first admonition-title">Note</p> |
---|
102 | <p class="last">Before starting this tutorial, you should have a working |
---|
103 | <a title="GeoExt.MapPanel" class="reference external" href="../lib/GeoExt/widgets/MapPanel.html#GeoExt.MapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.MapPanel</span></tt></a> in your page. The <a class="reference external" href="mappanel-tutorial.html"><em>MapPanel Tutorial</em></a> will |
---|
104 | help you set one up if you don’t already have one.</p> |
---|
105 | </div> |
---|
106 | <div class="section" id="start-with-a-map"> |
---|
107 | <h2>Start With a Map<a class="headerlink" href="#start-with-a-map" title="Permalink to this headline">¶</a></h2> |
---|
108 | <p>Let’s assume you already have a <a title="GeoExt.MapPanel" class="reference external" href="../lib/GeoExt/widgets/MapPanel.html#GeoExt.MapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.MapPanel</span></tt></a> on your page with some |
---|
109 | layers. In the <a class="reference external" href="mappanel-tutorial.html"><em>MapPanel Tutorial</em></a>, we discussed how you can use the |
---|
110 | <tt class="docutils literal"><span class="pre">layers</span></tt> property of the <tt class="docutils literal"><span class="pre">MapPanel</span></tt> to add, remove, and modify the layers of |
---|
111 | the map as well as monitor the layer list for changes. This is more than |
---|
112 | sufficient to display a ‘live’ list of layers in an <tt class="docutils literal"><span class="pre">Ext.grid.GridPanel</span></tt>. |
---|
113 | The <a title="GeoExt.tree.LayerContainer" class="reference external" href="../lib/GeoExt/widgets/tree/LayerContainer.html#GeoExt.tree.LayerContainer"><tt class="xref docutils literal"><span class="pre">GeoExt.tree.LayerContainer</span></tt></a> is another component that can listen to |
---|
114 | changes to the map’s layer list. However, rather than an independent panel, the |
---|
115 | <tt class="docutils literal"><span class="pre">LayerContainer</span></tt> is a node that must be contained in an <tt class="docutils literal"><span class="pre">Ext.tree.TreePanel</span></tt> |
---|
116 | to be displayed. Here’s an example rendering a layer tree to a <tt class="docutils literal"><span class="pre">div</span></tt>:</p> |
---|
117 | <div class="highlight-javascript"><div class="highlight"><pre><span class="kd">var</span> <span class="nx">mapPanel</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">MapPanel</span><span class="p">({</span> |
---|
118 | <span class="cm">/* Your configuration here */</span> |
---|
119 | <span class="p">});</span> |
---|
120 | |
---|
121 | <span class="kd">var</span> <span class="nx">layerList</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">tree</span><span class="p">.</span><span class="nx">LayerContainer</span><span class="p">({</span> |
---|
122 | <span class="nx">text</span><span class="o">:</span> <span class="s1">'All Layers'</span><span class="p">,</span> |
---|
123 | <span class="nx">layerStore</span><span class="o">:</span> <span class="nx">mapPanel</span><span class="p">.</span><span class="nx">layers</span><span class="p">,</span> |
---|
124 | <span class="nx">leaf</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> |
---|
125 | <span class="nx">expanded</span><span class="o">:</span> <span class="kc">true</span> |
---|
126 | <span class="p">});</span> |
---|
127 | |
---|
128 | <span class="kd">var</span> <span class="nx">layerTree</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Ext</span><span class="p">.</span><span class="nx">tree</span><span class="p">.</span><span class="nx">TreePanel</span><span class="p">({</span> |
---|
129 | <span class="nx">title</span><span class="o">:</span> <span class="s1">'Map Layers'</span><span class="p">,</span> |
---|
130 | <span class="nx">renderTo</span><span class="o">:</span> <span class="s1">'layerTree'</span><span class="p">,</span> |
---|
131 | <span class="nx">root</span><span class="o">:</span> <span class="nx">layerList</span> |
---|
132 | <span class="p">});</span> |
---|
133 | </pre></div> |
---|
134 | </div> |
---|
135 | <p><tt class="docutils literal"><span class="pre">LayerContainer</span></tt>s automatically add checkboxes (radio buttons for base |
---|
136 | layers) that can be used to toggle the visibility of layers. You can also enable |
---|
137 | drag-n-drop layer reordering by simply setting the <tt class="docutils literal"><span class="pre">enableDD</span></tt> property of the |
---|
138 | <tt class="docutils literal"><span class="pre">TreePanel</span></tt>.</p> |
---|
139 | </div> |
---|
140 | <div class="section" id="filtering"> |
---|
141 | <h2>Filtering<a class="headerlink" href="#filtering" title="Permalink to this headline">¶</a></h2> |
---|
142 | <p>By default, the <tt class="docutils literal"><span class="pre">LayerContainer</span></tt>‘s <tt class="docutils literal"><span class="pre">LayerLoader</span></tt> automatically pulls in all layers from the store and displays those with the <tt class="docutils literal"><span class="pre">displayInLayerSwitcher</span></tt> |
---|
143 | property set to true. You can provide your own filter function to the loader:</p> |
---|
144 | <div class="highlight-javascript"><div class="highlight"><pre><span class="kd">var</span> <span class="nx">layerList</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">tree</span><span class="p">.</span><span class="nx">LayerContainer</span><span class="p">({</span> |
---|
145 | <span class="nx">text</span><span class="o">:</span> <span class="s1">'Tasmania Layers'</span><span class="p">,</span> |
---|
146 | <span class="nx">layerStore</span><span class="o">:</span> <span class="nx">mapPanel</span><span class="p">.</span><span class="nx">layers</span><span class="p">,</span> |
---|
147 | <span class="nx">leaf</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> |
---|
148 | <span class="nx">expanded</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> |
---|
149 | <span class="nx">loader</span><span class="o">:</span> <span class="p">{</span> |
---|
150 | <span class="nx">filter</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">record</span><span class="p">)</span> <span class="p">{</span> |
---|
151 | <span class="k">return</span> <span class="nx">record</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">"layer"</span><span class="p">).</span><span class="nx">name</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">"Tasmania"</span><span class="p">)</span> <span class="o">!==</span> <span class="o">-</span><span class="mi">1</span> |
---|
152 | <span class="p">}</span> |
---|
153 | <span class="p">}</span> |
---|
154 | <span class="p">});</span> |
---|
155 | </pre></div> |
---|
156 | </div> |
---|
157 | <p>The above will only load layers with “Tasmania” in their name. By adding |
---|
158 | multiple named and filtered <tt class="docutils literal"><span class="pre">LayerContainer</span></tt>s to a <tt class="docutils literal"><span class="pre">TreePanel</span></tt> you are |
---|
159 | able to provide logical organization to your layer trees. When <tt class="docutils literal"><span class="pre">enableDD</span></tt> is |
---|
160 | set to true on the tree, drag-n-drop will also work between filtered layer |
---|
161 | containers, as long as they have the same parent node. You can also directly |
---|
162 | instantiate <a title="GeoExt.tree.LayerNode" class="reference external" href="../lib/GeoExt/widgets/tree/LayerNode.html#GeoExt.tree.LayerNode"><tt class="xref docutils literal"><span class="pre">GeoExt.tree.LayerNode</span></tt></a> to create tree nodes that can be |
---|
163 | added anywhere in a tree. Keep in mind, however, that this approach does not |
---|
164 | allow for automatic drag-n-drop support.</p> |
---|
165 | <div class="admonition note"> |
---|
166 | <p class="first admonition-title">Note</p> |
---|
167 | <p>There are two LayerContainer types with a preconfigured filter:</p> |
---|
168 | <ul class="last simple"> |
---|
169 | <li><a title="GeoExt.tree.BaseLayerContainer" class="reference external" href="../lib/GeoExt/widgets/tree/BaseLayerContainer.html#GeoExt.tree.BaseLayerContainer"><tt class="xref docutils literal"><span class="pre">GeoExt.tree.BaseLayerContainer</span></tt></a> will be populated only with layers |
---|
170 | that have isBaseLayer set to true,</li> |
---|
171 | <li><a title="GeoExt.tree.OverlayLayerContainer" class="reference external" href="../lib/GeoExt/widgets/tree/OverlayLayerContainer.html#GeoExt.tree.OverlayLayerContainer"><tt class="xref docutils literal"><span class="pre">GeoExt.tree.OverlayLayerContainer</span></tt></a> will be populated only with |
---|
172 | layers that have isBaseLayer set to false.</li> |
---|
173 | </ul> |
---|
174 | </div> |
---|
175 | </div> |
---|
176 | <div class="section" id="visibility-grouping"> |
---|
177 | <h2>Visibility Grouping<a class="headerlink" href="#visibility-grouping" title="Permalink to this headline">¶</a></h2> |
---|
178 | <p>The concept of a base layer in OpenLayers is just a gruop of layers that are on |
---|
179 | the bottom of the layer stack, and only one can be visible at a time. In maps |
---|
180 | without base layers (when <tt class="docutils literal"><span class="pre">allOverlays</span></tt> is set to true, the latter can be |
---|
181 | enforced by configuring a <tt class="docutils literal"><span class="pre">checkedGroup</span></tt> on a LayerNode. Such a layer node |
---|
182 | will be rendered with a radio button instead of a check box. Of all layers |
---|
183 | configured with the same <tt class="docutils literal"><span class="pre">checkedGroup</span></tt>, only one will be visible at a time:</p> |
---|
184 | <div class="highlight-javascript"><div class="highlight"><pre><span class="kd">var</span> <span class="nx">layerList</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">tree</span><span class="p">.</span><span class="nx">LayerContainer</span><span class="p">({</span> |
---|
185 | <span class="nx">text</span><span class="o">:</span> <span class="s1">'Tasmania Layers'</span><span class="p">,</span> |
---|
186 | <span class="nx">layerStore</span><span class="o">:</span> <span class="nx">mapPanel</span><span class="p">.</span><span class="nx">layers</span><span class="p">,</span> |
---|
187 | <span class="nx">leaf</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> |
---|
188 | <span class="nx">expanded</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> |
---|
189 | <span class="nx">loader</span><span class="o">:</span> <span class="p">{</span> |
---|
190 | <span class="nx">filter</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">record</span><span class="p">)</span> <span class="p">{</span> |
---|
191 | <span class="k">return</span> <span class="nx">record</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">"layer"</span><span class="p">).</span><span class="nx">name</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">"Tasmania"</span><span class="p">)</span> <span class="o">!==</span> <span class="o">-</span><span class="mi">1</span> |
---|
192 | <span class="p">},</span> |
---|
193 | <span class="nx">baseAttrs</span><span class="o">:</span> <span class="p">{</span> |
---|
194 | <span class="nx">checkedGroup</span><span class="o">:</span> <span class="s2">"tasmania"</span> |
---|
195 | <span class="p">}</span> |
---|
196 | <span class="p">}</span> |
---|
197 | <span class="p">});</span> |
---|
198 | </pre></div> |
---|
199 | </div> |
---|
200 | </div> |
---|
201 | <div class="section" id="layer-nodes-with-additional-radio-buttons"> |
---|
202 | <h2>Layer Nodes with Additional Radio Buttons<a class="headerlink" href="#layer-nodes-with-additional-radio-buttons" title="Permalink to this headline">¶</a></h2> |
---|
203 | <p>It is possible to render layer nodes with an additional radio button. This can |
---|
204 | be useful if an application uses the concept of an “active layer”. The active |
---|
205 | layer can then be set by clicking its radio button:</p> |
---|
206 | <div class="highlight-javascript"><div class="highlight"><pre><span class="kd">var</span> <span class="nx">layerList</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">tree</span><span class="p">.</span><span class="nx">LayerContainer</span><span class="p">({</span> |
---|
207 | <span class="nx">text</span><span class="o">:</span> <span class="s1">'All Layers'</span><span class="p">,</span> |
---|
208 | <span class="nx">layerStore</span><span class="o">:</span> <span class="nx">mapPanel</span><span class="p">.</span><span class="nx">layers</span><span class="p">,</span> |
---|
209 | <span class="nx">leaf</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> |
---|
210 | <span class="nx">expanded</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> |
---|
211 | <span class="nx">loader</span><span class="o">:</span> <span class="p">{</span> |
---|
212 | <span class="nx">baseAttrs</span><span class="o">:</span> <span class="p">{</span> |
---|
213 | <span class="nx">radioGroup</span><span class="o">:</span> <span class="s2">"active"</span> |
---|
214 | <span class="p">}</span> |
---|
215 | <span class="p">}</span> |
---|
216 | <span class="p">});</span> |
---|
217 | <span class="kd">var</span> <span class="nx">registerRadio</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> |
---|
218 | <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">node</span><span class="p">.</span><span class="nx">hasListener</span><span class="p">(</span><span class="s2">"radiochange"</span><span class="p">))</span> <span class="p">{</span> |
---|
219 | <span class="nx">node</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s2">"radiochange"</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">node</span><span class="p">){</span> |
---|
220 | <span class="cm">/* set your active layer here */</span> |
---|
221 | <span class="p">});</span> |
---|
222 | <span class="p">}</span> |
---|
223 | <span class="p">}</span> |
---|
224 | <span class="kd">var</span> <span class="nx">layerTree</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Ext</span><span class="p">.</span><span class="nx">tree</span><span class="p">.</span><span class="nx">TreePanel</span><span class="p">({</span> |
---|
225 | <span class="nx">title</span><span class="o">:</span> <span class="s1">'Map Layers'</span><span class="p">,</span> |
---|
226 | <span class="nx">renderTo</span><span class="o">:</span> <span class="s1">'layerTree'</span><span class="p">,</span> |
---|
227 | <span class="nx">root</span><span class="o">:</span> <span class="nx">layerList</span><span class="p">,</span> |
---|
228 | <span class="nx">listeners</span><span class="o">:</span> <span class="p">{</span> |
---|
229 | <span class="nx">append</span><span class="o">:</span> <span class="nx">registerRadio</span><span class="p">,</span> |
---|
230 | <span class="nx">insert</span><span class="o">:</span> <span class="nx">registerRadio</span> |
---|
231 | <span class="p">}</span> |
---|
232 | <span class="p">});</span> |
---|
233 | </pre></div> |
---|
234 | </div> |
---|
235 | <p>The layer node fires the “radiochange” event when the radio button is clicked. |
---|
236 | The above snippet configures a listener for this event when a node is added to |
---|
237 | or inserted in the tree.</p> |
---|
238 | </div> |
---|
239 | <div class="section" id="sub-layers"> |
---|
240 | <h2>Sub-Layers<a class="headerlink" href="#sub-layers" title="Permalink to this headline">¶</a></h2> |
---|
241 | <p>Layers that have a <tt class="docutils literal"><span class="pre">params</span></tt> property (like <tt class="docutils literal"><span class="pre">OpenLayers.Layer.WMS</span></tt>) can be |
---|
242 | used to create sub-layers based on one of the <tt class="docutils literal"><span class="pre">params</span></tt> properties. This is |
---|
243 | useful to e.g. create sub-nodes from the layer object’s “LAYERS” or “CQL_FILTER” |
---|
244 | param:</p> |
---|
245 | <div class="highlight-javascript"><div class="highlight"><pre><span class="kd">var</span> <span class="nx">groupLayer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">OpenLayers</span><span class="p">.</span><span class="nx">Layer</span><span class="p">.</span><span class="nx">WMS</span><span class="p">(</span><span class="s2">"Tasmania (Group Layer)"</span><span class="p">,</span> |
---|
246 | <span class="s2">"http://demo.opengeo.org/geoserver/wms"</span><span class="p">,</span> <span class="p">{</span> |
---|
247 | <span class="nx">layers</span><span class="o">:</span> <span class="p">[</span> |
---|
248 | <span class="s2">"topp:tasmania_state_boundaries"</span><span class="p">,</span> |
---|
249 | <span class="s2">"topp:tasmania_water_bodies"</span><span class="p">,</span> |
---|
250 | <span class="s2">"topp:tasmania_cities"</span><span class="p">,</span> |
---|
251 | <span class="s2">"topp:tasmania_roads"</span> |
---|
252 | <span class="p">],</span> |
---|
253 | <span class="nx">transparent</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> |
---|
254 | <span class="nx">format</span><span class="o">:</span> <span class="s2">"image/gif"</span> |
---|
255 | <span class="p">}</span> |
---|
256 | <span class="p">);</span> |
---|
257 | <span class="kd">var</span> <span class="nx">groupLayerNode</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">tree</span><span class="p">.</span><span class="nx">LayerNode</span><span class="p">({</span> |
---|
258 | <span class="nx">layer</span><span class="o">:</span> <span class="nx">groupLayer</span><span class="p">,</span> |
---|
259 | <span class="nx">leaf</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> |
---|
260 | <span class="nx">expanded</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> |
---|
261 | <span class="nx">loader</span><span class="o">:</span> <span class="p">{</span> |
---|
262 | <span class="nx">param</span><span class="o">:</span> <span class="s2">"LAYERS"</span> |
---|
263 | <span class="p">}</span> |
---|
264 | <span class="p">});</span> |
---|
265 | </pre></div> |
---|
266 | </div> |
---|
267 | <div class="admonition note"> |
---|
268 | <p class="first admonition-title">Note</p> |
---|
269 | <p class="last">The <a title="GeoExt.tree.LayerParamLoader" class="reference external" href="../lib/GeoExt/widgets/tree/LayerParamLoader.html#GeoExt.tree.LayerParamLoader"><tt class="xref docutils literal"><span class="pre">GeoExt.tree.LayerParamLoader</span></tt></a> does not add drag-n-drop support |
---|
270 | to the sub-nodes it creates, so <tt class="docutils literal"><span class="pre">allowDrag</span></tt> and <tt class="docutils literal"><span class="pre">allowDrag</span></tt> should be |
---|
271 | set to false for a <a title="GeoExt.tree.LayerNode" class="reference external" href="../lib/GeoExt/widgets/tree/LayerNode.html#GeoExt.tree.LayerNode"><tt class="xref docutils literal"><span class="pre">GeoExt.tree.LayerNode</span></tt></a> configured with a |
---|
272 | <tt class="xref docutils literal"><span class="pre">GeoExt.class.LayerParamLoader</span></tt>, unless you provide custom “move” |
---|
273 | handlers.</p> |
---|
274 | </div> |
---|
275 | <div class="admonition-see-also admonition seealso"> |
---|
276 | <p class="first admonition-title">See also</p> |
---|
277 | <p class="last">The ExtJS TreePanel <a class="reference external" href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.tree.TreePanel">documentation</a> and <a class="reference external" href="http://dev.sencha.com/deploy/dev/examples/#sample-7">examples</a> for more |
---|
278 | information about customizing tree panels.</p> |
---|
279 | </div> |
---|
280 | </div> |
---|
281 | </div> |
---|
282 | |
---|
283 | |
---|
284 | </div> |
---|
285 | </div> |
---|
286 | </div> |
---|
287 | <div class="clearer"></div> |
---|
288 | </div> |
---|
289 | <div class="related"> |
---|
290 | <h3>Navigation</h3> |
---|
291 | <ul> |
---|
292 | <li class="right" style="margin-right: 10px"> |
---|
293 | <a href="../genindex.html" title="General Index" |
---|
294 | accesskey="I">index</a></li> |
---|
295 | <li class="right" > |
---|
296 | <a href="../modindex.html" title="Global Module Index" |
---|
297 | accesskey="M">modules</a> |</li> |
---|
298 | <li class="right" > |
---|
299 | <a href="control-button-tutorial.html" title="Map Tool Tutorial" |
---|
300 | accesskey="N">next</a> |</li> |
---|
301 | <li class="right" > |
---|
302 | <a href="mappanel-tutorial.html" title="MapPanel Tutorial" |
---|
303 | accesskey="P">previous</a> |</li> |
---|
304 | <li><a href="../index.html">GeoExt</a> »</li> |
---|
305 | <li><a href="index.html" >Tutorials</a> »</li> |
---|
306 | <li><a href="#">Layer Tree Tutorial</a></li> |
---|
307 | </ul> |
---|
308 | </div> |
---|
309 | |
---|
310 | <div class="footer"> |
---|
311 | © Copyright 2009-2010, GeoExt Community. |
---|
312 | </div> |
---|
313 | </body> |
---|
314 | </html> |
---|