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)
Either way, the filter function parameter of the loader is what will get you 
your layer added to the correct parent node

Matt Priour


From: IT Intern 
Sent: Monday, November 29, 2010 12:38 PM
To: [email protected] 
Subject: Re: [Users] Dynamic Node does not bind to layer


Dear Matt,

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 ...

Thank you,

elshae


On Mon, Nov 29, 2010 at 1:33 PM, Matt Priour <[email protected]> 
wrote:

  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.
  Remove the additional listener that you are adding and things should work 
much better.

  Matt Priour


  From: IT Intern 
  Sent: Monday, November 29, 2010 12:28 PM
  To: [email protected] 
  Subject: [Users] Dynamic Node does not bind to layer


  Hello GeoExt list,

  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:


  this.node.getOwnerTree() is null
   var checkedNodes = this.node.getOwnerTree().getChecked();

  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 :)

  Thanks,

  elshae


      
      map.events.register("addlayer", this, function() {
          var l = map.layers[map.layers.length-1];
          layerStore.loadData([l], true);
          var className = '';
          if (l.isBaseLayer || !l.displayInLayerSwitcher) {
              className = 'x-hidden';
          }
        
          var node = new GeoExt.tree.LayerNode({
              layerStore: layerStore,
              layer: l,
              checkedGroup: 'foo',
              checked: false
          });
          // todo, depends on ascending whether to use insertBefore or 
appendChild
          //this.getRootNode().insertBefore(node, 
this.getRootNode().firstChild); 
          layerRoot.getOwnerTree().getNodeById('photos').appendChild(node);
          });

  map.addLayer(vectorPano);



------------------------------------------------------------------------------


  _______________________________________________
  Users mailing list
  [email protected]
  http://www.geoext.org/cgi-bin/mailman/listinfo/users





--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to