[Users] Dynamic Node does not bind to layer
IT Intern
itintern12 at gmail.com
Mon Nov 29 21:20:10 CET 2010
Thanks Matt,
I got the right filter ;)
loader:{
filter: function(record) {
return record.get("layer").name.indexOf("Photos") == -1
}
}
Still a little puzzled on why displayInLayerSwitcher: false didn't work out
:-/
But many many thanks, I was stuck on this for awhile...
elshae
On Mon, Nov 29, 2010 at 3:08 PM, IT Intern <itintern12 at gmail.com> wrote:
> Dear Matt,
>
> Hmm this seems like this might be a way for me to go..yet one thing that
> has me puzzled is that if I declare my layer to have displayInLayerSwitcher:
> false, shouldn't it be that this layer does not append a node to the
> containers? I was just trying to avoid having to have each and every layer
> container filter out this one layer, other than that I am actually having
> troubles filtering out the layer itself :p
>
> loader:{
> filter: function(record) {
> //From GeoExt examples...
> //return record.get("layer").name.indexOf("Tasmania")
> !== -1
> //my attempt
> return record.get("layer").name != 'Photos'; // :( not
> working
> }
> }
>
> Thanks,
>
> elshae
>
>
> On Mon, Nov 29, 2010 at 2:25 PM, Matt Priour <mpriour at kestrelcomputer.com>wrote:
>
>> 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 <itintern12 at gmail.com>
>> *Sent:* Monday, November 29, 2010 12:38 PM
>> *To:* Users at geoext.org
>> *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 <mpriour at kestrelcomputer.com
>> > 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 <itintern12 at gmail.com>
>>> *Sent:* Monday, November 29, 2010 12:28 PM
>>> *To:* users at geoext.org
>>> *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
>>> Users at geoext.org
>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101129/675cb009/attachment-0001.htm
More information about the Users
mailing list