<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-1>
<META content="MSHTML 6.00.6002.18309" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=Arial size=2>The LayerStore associtated with the map already has
register listeners in the map to take care of adding layers to itself when you
add them to the map or vice versa.</FONT></DIV>
<DIV><FONT face=Arial size=2>Remove the additional listener that you are adding
and things should work much better.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Matt Priour</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=itintern12@gmail.com
href="mailto:itintern12@gmail.com">IT Intern</A> </DIV>
<DIV><B>Sent:</B> Monday, November 29, 2010 12:28 PM</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] Dynamic Node does not bind to
layer</DIV></DIV></DIV>
<DIV><BR></DIV>Hello GeoExt list,<BR><BR>I have a tree panel which I append a
child node to after it has been created. The node appears, but when it is
toggled on and off I get the error in firebug:<BR><BR>
<DIV class="errorTitle focusRow subLogRow "><SPAN
class="errorDuplication "></SPAN>this.node.getOwnerTree() is null</DIV><SPAN
class=" "></SPAN>
<DIV class="errorSourceBox errorSource-show focusRow subLogRow "><IMG
class="errorBreak a11yFocus " title="Break on this error"
src="chrome://firebug/content/blank.gif"><A class="errorSource a11yFocus "> var
checkedNodes = this.node.getOwnerTree().getChecked();<BR><BR>Also the layer does
not appear on and off as the node is toggled. I have tried several things,
last thing I tried is listening to the event of where the map has added the
layer and then adding the layer to the layer store and creating the node and
appending it to the root node of the tree panel. Please if anyone knows
why this is failing please drop me a hint
:)<BR><BR>Thanks,<BR><BR>elshae<BR><BR></A></DIV>
<BR> map.events.register("addlayer", this, function()
{<BR> var l =
map.layers[map.layers.length-1];<BR>
layerStore.loadData([l], true);<BR>
var className = '';<BR> if
(l.isBaseLayer || !l.displayInLayerSwitcher)
{<BR>
className = 'x-hidden';<BR>
}<BR>
<BR> var node = new
GeoExt.tree.LayerNode({<BR>
layerStore:
layerStore,<BR>
layer: l,<BR>
checkedGroup: 'foo',<BR>
checked: false<BR>
});<BR> // todo, depends on ascending
whether to use insertBefore or
appendChild<BR>
//this.getRootNode().insertBefore(node, this.getRootNode().firstChild);
<BR>
layerRoot.getOwnerTree().getNodeById('photos').appendChild(node);<BR>
});<BR><BR>map.addLayer(vectorPano);<BR>
<P>
<HR>
<P></P>_______________________________________________<BR>Users mailing
list<BR>Users@geoext.org<BR>http://www.geoext.org/cgi-bin/mailman/listinfo/users<BR></BODY></HTML>