[Users] layerTree EnableDD

Andreas Hocevar ahocevar at opengeo.org
Tue Sep 1 09:22:45 CEST 2009


Hi Arnaud,

sorry for the very late reply.

Arnaud Vandecasteele wrote:
> I'm trying to understand the way that the EXT Tree works with the
> GeoExt elements and particulary the enableDD config.
>
> 1/ When my config tree is that one, with both  gx_baselayercontainer
> and gx_overlaylayercontainer the enableDD works :
>
>     var treeConfig = new OpenLayers.Format.JSON().write([
>         {
>             nodeType    : 'gx_baselayercontainer'
>             ,expanded   : true
>             ,allowDrag  : false
>             ,allowDrop  : false
>             ,draggable  : false
>             ,icon       : './img/map.png'
>         },{
>             nodeType    : 'gx_overlaylayercontainer'
>             ,expanded   : true
>             ,icon       : './img/map.png'
>         }
>     ], true);
>
> For only one layer (this one is associated with a FeatureStore and a 
> GridPanel) nothing happen when i drag it. Is it normal?

Yes, this is normal. The LayerLoader of a LayerContainer adds a move
event handler to each layer node it creates. Standalone layer nodes
don't have a move event handler unless you specify one.

> 2/ But when I trie to configure my tree layer by layer (gx_layer) the
> enableDD doesn't seems to work
>
>     var treeConfig = new OpenLayers.Format.JSON().write([
>         {
>             nodeType    : 'gx_baselayercontainer'
>             ,expanded   : true
>             ,allowDrag  : false
>             ,allowDrop  : false
>             ,draggable  : false
>             ,icon       : './img/map.png'
>         },,{
>             text        : 'Overlays'
>             ,draggable  : false
>             ,expanded   : true
>             ,icon       : './img/maps-stack.png'
>             ,children: [
>                 {
>                     nodeType    : 'gx_layer'
>                     ,layer      : 'city'
>                     ,icon       : './img/city-16x16.png'
>                 },{
>                     nodeType    : 'gx_layer'
>                     ,layer      : 'moutains'
>                     ,icon       : './img/Mountain-16x16.png' 
>                 },{
>                     nodeType    : 'gx_layer'
>                     ,layer      : 'vmap'
>                     ,icon       : './img/Mountain-16x16.png' 
>                 }
>             ]           
>         }
>     ], true);
>
> Could you help me to understand the way it works.

See above. I hope this explains things a bit.

Regards,
Andreas.


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



More information about the Users mailing list