<div class="gmail_quote">2010/12/7 Alexandre Dube <span dir="ltr"><<a href="mailto:adube@mapgears.com">adube@mapgears.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
There you go :<br>
<a href="http://dev.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/examples/tree-builder.html" target="_blank">http://dev.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/examples/tree-builder.html</a><br>
<br>
Only added nodes are currently managed. I still need to do some work<br>
for the removed nodes.<br></blockquote><div><br></div><div><br></div><div>Hi,</div><div><br></div><div>thanks for sharing this useful component!!</div><div><br></div><div>I'm also working on a similar tree, I tested yours but since I use a lot of GeoExt "magic" (a layer store and no explicit calls to map), the tree is not automatically populated because the layerStore add event takes place before the tree itself exists.</div>
<div><br></div><div>I had to add a listener to the tree, I'm not sure it is the preferred method, but maybe you want to add it to the code:</div><div><br></div><div><div> // ABP: make sure tree is populated</div><div>
onAfterRender : function(self){</div><div> // ABP: what if the store was already populated but the tree is empty?</div><div> if(! this.root.childNodes.length && this.layerStore.getRange() ){</div>
<div> this.onLayerAdded(this.layerStore, this.layerStore.getRange(), 0);</div><div> }</div><div> },</div><div> </div></div><div>... and in initComponent</div><div><div> // ABP: add event handler</div>
<div> this.on('afterrender', this.onAfterRender);</div></div><div><br></div><div><br></div><div>Another issue is with the checkboxes, it seems like unchecking a children, unchecks the whole tree (upwards) even if a sibling is still checked.</div>
</div><div><br></div><div>The best option would be to have a tristate checkbox for partially checked subtrees.</div><div><br></div><br>-- <br>Alessandro Pasotti<br>w3: <a href="http://www.itopen.it">www.itopen.it</a><br>