<!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>What you want to do is to create your layer with
some attribute that you are filtering for when creating its
parent LayerContainerNode. This way when you add it to the map it is either
added to the correct parent node because it is filtered out of the other layer
container nodes filter function or it is not added to any nodes until you
manually call the load method on the parent LayerContainerNode. (I just haven't
looked at the code to know if the layertree is automatically updated or if you
have to call load)</FONT></DIV>
<DIV><FONT face=Arial size=2>Either way, the filter function parameter of the
loader is what will get you your layer added to the correct parent
node</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><FONT face=Arial></FONT><FONT face=Arial></FONT><FONT
face=Arial></FONT><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:38 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> Re: [Users] Dynamic Node does not bind to
layer</DIV></DIV></DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><BR></DIV>Dear Matt,<BR><BR>Thanks for your feedback!
Unfortunately I have tried that and I still have a little problem :-/.
When I remove the additional listener everything works great, except every layer
container on my tree now has a node for this layer which is not what I want
:(. I need a way that I append a single node to a single layer container
...<BR><BR>Thank you,<BR><BR>elshae<BR><BR>
<DIV class=gmail_quote>On Mon, Nov 29, 2010 at 1:33 PM, Matt Priour <SPAN
dir=ltr><<A
href="mailto:mpriour@kestrelcomputer.com">mpriour@kestrelcomputer.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px"
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><FONT face=Arial></FONT><FONT face=Arial></FONT><BR></DIV>
<DIV style="BACKGROUND: rgb(245,245,245)">
<DIV><B>From:</B> <A title=itintern12@gmail.com
href="mailto:itintern12@gmail.com" target=_blank>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"
target=_blank>users@geoext.org</A> </DIV>
<DIV><B>Subject:</B> [Users] Dynamic Node does not bind to
layer</DIV></DIV></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><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><SPAN></SPAN>this.node.getOwnerTree() is null</DIV><SPAN></SPAN>
<DIV><IMG title="Break on this error" src=""><A> 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></DIV></DIV>
<P></P>
<HR>
<P></P>_______________________________________________<BR>Users mailing
list<BR><A href="mailto:Users@geoext.org"
target=_blank>Users@geoext.org</A><BR><A
href="http://www.geoext.org/cgi-bin/mailman/listinfo/users"
target=_blank>http://www.geoext.org/cgi-bin/mailman/listinfo/users</A><BR></DIV></BLOCKQUOTE></DIV><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>