[Users] How to register different "dblclick" listener on BaseLayerContainer and OverlayLayerContainer

Andreas Hocevar ahocevar at opengeo.org
Wed May 4 09:33:27 CEST 2011


I just confirmed that this doesn't work. But using the tree.js
example, I also confirmed that a different approach works:

--- examples/tree.js	(revision 2656)
+++ examples/tree.js	(working copy)
@@ -166,6 +166,9 @@
         listeners: {
             "radiochange": function(node){
                 alert(node.layer.name + " is now the the active layer.");
+            },
+            "added": function(node) {
+                node.on("dblclick", function() {alert("dblclick");})
             }
         },
         rootVisible: false,

Regards,
Andreas.

On Tue, May 3, 2011 at 7:28 PM, Yingqi Tang <anakintang at gmail.com> wrote:
> I did the same in example tree.html and it doesn't have any effect either.
>
> On Tue, May 3, 2011 at 10:16 AM, Yingqi Tang <anakintang at gmail.com> wrote:
>>
>> Andreas,
>> Thanks for information, but this approach doesn't seem to do for me. The
>> dblclick handler set in baseAttrs is never triggered.
>> Thanks,
>> Yingqi
>>
>> On Tue, May 3, 2011 at 12:10 AM, Andreas Hocevar <ahocevar at opengeo.org>
>> wrote:
>>>
>>> Hi,
>>>
>>> you can register the listener on every node that the loader creates.
>>> To do so, you have to configure a listeners object in the baseAttrs of
>>> the loader. See modification of your snippet inline:
>>>
>>> On Tue, May 3, 2011 at 7:20 AM, Yingqi Tang <anakintang at gmail.com> wrote:
>>> > Hi all,
>>> >
>>> > In my GeoExt web app I have created a TreePanel, in which I have both a
>>> > BaseLayerContainer and OverlayLayerContainer as its children. This is
>>> > the
>>> > JSON config:
>>> >
>>> > layerTreeJsonConfig = [
>>> >         {    // baselayer container
>>> >             nodeType: "gx_baselayercontainer",
>>> >             text: 'basemap'
>>> >         },
>>> >         {    // overlayer container
>>> >             nodeType: "gx_overlaylayercontainer",
>>> >             text: 'overlays',
>>> >             expanded: false,
>>> >             // render the nodes inside this container with a radio
>>> > button,
>>> >             // and assign them the group "overlayers".
>>> >             loader: {
>>> >                 baseAttrs: {
>>> >                     radioGroup: "overlayers",
>>> >                     uiProvider: "layernodeui"
>>>
>>>                       ,listeners: {dblclick: function() {/* do something
>>> */}}
>>>
>>> >                 }
>>> >             }
>>> >         }
>>> >     ];
>>>
>>> Regards,
>>> Andreas.
>>>
>>> >
>>> > I know and I was able to register "dblclick" listener on the TreePanel,
>>> > now
>>> > my question is whether there is a way to register different event
>>> > handler on
>>> > those two different layer container? The reason I am asking is that I
>>> > am
>>> > trying to another custom layer container which inherits from
>>> > OverlayLayerContainer, and I would like wrap some event handler inside
>>> > that
>>> > custom layer container instead of adding it on TreePanel for all.
>>> >
>>> > Thanks.
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > Users mailing list
>>> > Users at geoext.org
>>> > http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> Andreas Hocevar
>>> OpenGeo - http://opengeo.org/
>>> Expert service straight from the developers.
>>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list