<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=utf-8>
<STYLE type=text/css><!-- DIV {margin:0px;} --></STYLE>
<META content="MSHTML 6.00.6002.18332" 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>I understand you are honestly trying to figure out
how to use GeoExt and teaching yourself how to program using the OpenGeo stack,
however at this point I think you have become a "Help Vampire" [1]
.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>You are not following recommendations given on the
list, not reading the documentation, not following the examples, and not opening
the GeoExt library source to understand how things work.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The behavior you describe below is exactly what one
would expect. You have been given the answer before and warned against trying to
use multiple stores and encouraged to learn how to use the loader's filter
function, yet I see the same errors below.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>An 'async' tree node (which all LayerNodes and
LayerContainerNodes are derived from) fire their load function when they are
expanded. Look at the code for the OverlayLayerContainer's load function and you
will see very easily why this problem is happening. You should also be able to
quickly gain a much better understanding of the right way to configure your
nodes so that they behave in the expected manner.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>While I certainly understand the difficulty of
learning something completely new and trying to do your normal job as well
(trust me, I've been there, as have most others on this list), we can't hold
your hand and give you answer after answer unless you are also making an equal
effort to actually learn the tools. Spend a few evenings or weekends following
through the source code, take the examples and start changing them in a
controlled way so that you understand the effect of different options or
techniques for doing things.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>GeoExt is a fairly high level library. You can use
it in a lot of scenarios with little understanding of the libraries it depends
on and it will do all kinds of cool things automatically. However, due to its
dependence on both OpenLayers & ExtJS, if you want to do something extra or
custom with GeoExt, then you really need to understand it's inner workings or
you will continue to have problems.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Matt Priour</FONT></DIV>
<DIV><FONT face=Arial size=2>Kestrel Computer Consutling</DIV>
<DIV><BR>[1] <A
href="http://slash7.com/2006/12/22/vampires/">http://slash7.com/2006/12/22/vampires/</A></DIV>
<DIV> </DIV>
<DIV></FONT> </DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=robertdbuckley@yahoo.com
href="mailto:robertdbuckley@yahoo.com">Robert Buckley</A> </DIV>
<DIV><B>Sent:</B> Wednesday, January 19, 2011 2:36 AM</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] How to remove node from
GeoExt.tree.OverlayLayerContainer?</DIV></DIV></DIV>
<DIV><BR></DIV>
<DIV
style="FONT-SIZE: 8pt; FONT-FAMILY: arial,helvetica,sans-serif">Hi,<BR><BR>I
have defined an GeoExt.tree.OverlayLayerContainer called "zusatzlayer". The
store has to be set with no layers otherwise ALL layers are
added<BR><BR>CODE:<BR><BR>// Zusatz Stores<BR> var
zusatz_store = new GeoExt.data.LayerStore({<BR>
id:"Zusatzlayer",<BR>
text: "Zusatzlayer",<BR>
map:map,<BR> initDir:
0,<BR> layers:[]<BR>
});<BR><BR>layerRoot.appendChild(new
GeoExt.tree.OverlayLayerContainer({<BR> id:
'Zusatzlayer',<BR> text: "<span
class='TreeHeader'>Zusatzlayer</span>",<BR>
layerStore: zusatz_store,<BR>
leaf: false<BR>
})<BR> );<BR><BR><BR><SPAN style="COLOR: rgb(255,0,0)">In this
OverlayLayerContainer I can append layers out of a grid using the following
function in a bbar...</SPAN><BR><BR>bbar: [new
Ext.Button({<BR>
text: "Layer
hinzuf&uuml;gen",<BR>
tooltip : 'Layer
hinzuf&uuml;gen',<BR>
handler: function()
{<BR>
capabilitiesgrid.getSelectionModel().each(function(record)
{<BR>
var clone =
record.clone();<BR>
clone.get("layer").mergeNewParams({<BR>
format: "image/png",<BR>
transparent: true<BR>
}) <BR>
<BR>
layerRoot.getOwnerTree().getNodeById('Zusatzlayer').appendChild(new
Ext.tree.TreeNode({<BR> text:
clone.get("layer").name,<BR> checked:
true,<BR> listeners:
{<BR>
'checkchange': function(node,
checked){<BR>
if(checked){<BR>
// Ext.MessageBox.alert(null,
'checked');<BR>
clone.get("layer").setVisibility(true);<BR>
}else{<BR>
// Ext.MessageBox.alert(null, 'not
checked');<BR>
clone.get("layer").setVisibility(false);<BR>
}<BR>
}<BR> },<BR>
}) <BR>
);<BR><BR> // <SPAN style="COLOR: rgb(255,0,0)">THIS
ADDS THE LAYER</SPAN><BR><BR>
mapPanel.layers.add(clone); <BR>
<BR>
// zoom on to new layer<BR> var
bounds = new
OpenLayers.Bounds.fromArray(clone.get("llbbox"))<BR>
bounds.transform(epsg4326,
map.getProjectionObject());<BR>
map.zoomToExtent(bounds)<BR>
<BR>
});<BR>
<BR> }<BR>
<BR>
<BR> })<BR>
,<BR><BR><BR>THE PROBLEM...... If the treenode is expanded,
the layer is being added twice!!!<BR><BR>Could anyone offer any
solutions?<BR><BR>thanks for any help,<BR><BR>Rob<BR>
<DIV><BR></DIV></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>