Hello GeoExt users,<br><br>
<p>I have an <code>Ext.tree.TreePanel</code> that I later add a layer to
one of it's child containers after that container has been created.
The child container is an <code>GeoExt.tree.OverlayLayerContainer</code>.
The two things that I am struggling with are how to set the tree nodes
of an <code>GeoExt.tree.OverlayLayerContainer</code> to radio buttons
instead of checkboxes? and how do I add nodes later on to the container?
My attempt at this is below:</p>
<pre class="prettyprint"><code><span class="kwd">function</span><span class="pln"> childContainer</span><span class="pun">(</span><span class="pln">text</span><span class="pun">,</span><span class="pln"> layerStore</span><span class="pun">,</span><span class="pln"> parent</span><span class="pun">,</span><span class="pln"> iconCls</span><span class="pun">){</span><span class="pln"><br>
<br> parent</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">GeoExt</span><span class="pun">.</span><span class="pln">tree</span><span class="pun">.</span><span class="typ">OverlayLayerContainer</span><span class="pun">({</span><span class="pln"><br>
text</span><span class="pun">:</span><span class="pln"> text</span><span class="pun">,</span><span class="pln"><br> layerStore</span><span class="pun">:</span><span class="pln"> layerStore</span><span class="pun">,</span><span class="pln"><br>
expanded</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln"><br> iconCls</span><span class="pun">:</span><span class="pln"> iconCls</span><span class="pun">,</span><span class="pln"> </span><span class="com">//If not specified, defaults to original image</span><span class="pln"><br>
loader</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln">param</span><span class="pun">:</span><span class="pln"> </span><span class="str">"LAYERS"</span><span class="pun">}</span><span class="pln"><br>
</span><span class="pun">}));</span><span class="pln"><br><br></span><span class="pun">}</span><span class="com">//end childContainer</span><span class="pln"><br><br></span><span class="com">//Container for photo layers</span><span class="pln"><br>
childContainer</span><span class="pun">(</span><span class="str">"Photo Layers"</span><span class="pun">,</span><span class="pln"> photoLayers</span><span class="pun">,</span><span class="pln"> layerRoot</span><span class="pun">);</span><span class="pln"><br>
<br></span><span class="com">//In another function</span><span class="pln"><br>map</span><span class="pun">.</span><span class="pln">addLayer</span><span class="pun">(</span><span class="pln">vectorPano</span><span class="pun">);</span><span class="pln"><br>
<br>layerStore</span><span class="pun">.</span><span class="pln">loadData</span><span class="pun">([</span><span class="pln">vectorPano</span><span class="pun">],</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">);</span><span class="pln"><br>
</span><span class="kwd">var</span><span class="pln"> panoNode </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Ext</span><span class="pun">.</span><span class="pln">tree</span><span class="pun">.</span><span class="typ">TreeNode</span><span class="pun">({</span><span class="pln"><br>
leaf</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln"><br> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'Panoramio Photos'</span><span class="pun">,</span><span class="pln"><br>
</span><span class="kwd">checked</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pln"><br><br> </span><span class="pun">});</span><span class="pln"><br>
panoNode</span><span class="pun">.</span><span class="pln">addListener</span><span class="pun">(</span><span class="str">"radiochange"</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(){</span><span class="pln"><br>
vectorPano</span><span class="pun">.</span><span class="pln">setVisibility</span><span class="pun">(</span><span class="kwd">true</span><span class="pun">);</span><span class="pln"><br> </span><span class="pun">});</span><span class="pln"><br>
</span><span class="kwd">var</span><span class="pln"> layerContainer </span><span class="pun">=</span><span class="pln"> layerRoot</span><span class="pun">.</span><span class="pln">findChild</span><span class="pun">(</span><span class="str">'text'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'Photo Layers'</span><span class="pun">);</span><span class="pln"><br>
layerContainer</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">panoNode</span><span class="pun">);</span><span class="pln"><br></span></code></pre>
<p>Currently a node is added, but it is a checkbox and when it is
clicked on and off it does not turn the layer on/off. I'd prefer radio
buttons nodes..</p>
<p>Thank you for your time,</p>
<p>elshae</p><br>