<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">Hi,</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">I have a mappping project which uses the Ext.TreePanel to configure the layers as displayed underneath. I would like to be able to move the layers around (which is possible using enableDD: true) but in my case the</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">drawing order doesn´t change. I.e when I move a layer upwards the drawing order (z-index) stays the same.</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">What should I do to change the drawing order of
the layers in the map when I change the order in the tree?</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">Thanks for any tips,</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">Rob</div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">First the layers definitions are defined...e.g</div><div><div><font face="arial, helvetica, sans-serif"
size="2"> </font></div><div><font face="arial, helvetica, sans-serif" size="2">var layer_zgb_grenze = new OpenLayers.Layer.WMS("Verwaltungsgrenzen: Planungsraum / Landkreis", "/geoserver/gwc/service/wms", {</font></div><div><font face="arial, helvetica, sans-serif" size="2"> layers: 'LK_Grenzen_gwc',</font></div><div><font face="arial, helvetica, sans-serif" size="2"> format: 'image/png',</font></div><div><font face="arial, helvetica, sans-serif" size="2"> transparent: true,</font></div><div><font face="arial, helvetica, sans-serif" size="2"> singleTile: true</font></div><div><font face="arial, helvetica, sans-serif" size="2"> }, {</font></div><div><font face="arial, helvetica, sans-serif" size="2"> 'buffer': 0,</font></div><div><font face="arial, helvetica, sans-serif" size="2">
'opacity': 1,</font></div><div><font face="arial, helvetica, sans-serif" size="2"> 'isBaseLayer': false,</font></div><div><font face="arial, helvetica, sans-serif" size="2"> visibility: true</font></div><div><font face="arial, helvetica, sans-serif" size="2"> });</font></div><div><font face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2">...etc</font></div><div><font face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2">then I put the layers into an array so I can check their initial drawing order in the map (ps I have around 100 layers so this way it´s easier to see)</font></div><div><font face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2">e.g..</font></div><div><font
face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>// layers added first are at the bottom of the z-index</font></div><div><span style="font-family: arial, helvetica, sans-serif; font-size: small;"><br></span></div><div><font face="arial, helvetica, sans-serif" size="2"><div> </div><div> var grenzen_layers = [];</div><div> grenzen_layers.push(Layer_grenzen_sg,Layer_grenzen_mg,layer_zgb_grenze);</div><div> map.addLayers(grenzen_layers); </div></font></div><div><font face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2">then the layers are put into the tree using the following....</font></div><div><font face="arial, helvetica,
sans-serif" size="2"><br></font></div><div><font face="arial, helvetica, sans-serif" size="2">// create tree structure</font></div><div><font style="font-family: arial, helvetica, sans-serif; font-size: 13px; "><div>var treeConfig = [</div><div> {</div><div> nodeType: "gx_baselayercontainer",</div><div> text: "Basiskarten",</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> expanded: true,<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> hidden:true, </div><div> leaf: true,</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> loader: {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> <span class="Apple-tab-span" style="white-space:pre">        </span>param:
"LAYERS"</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> }</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>},</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>text: "DOP",</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>expanded: true,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>children: [</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'DOP',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: dop,</div><div><span
class="Apple-tab-span" style="white-space:pre">                </span> // <span class="Apple-tab-span" style="white-space:pre">        </span> icon: 'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Grenzen_SG_gen',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> qtip: "DOP"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> }]</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>},</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>text: "Verwaltungsgrenzen",</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>expanded: true,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>children: [</div><div><span
class="Apple-tab-span" style="white-space:pre">                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'Planungsraum / Landkreis Grenze',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: layer_zgb_grenze,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> <span class="Apple-tab-span" style="white-space:pre">        </span>// icon: 'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V1_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> qtip: "Metadata"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>
},</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'Samtgemeinde Grenze',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: Layer_grenzen_sg,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> <span class="Apple-tab-span" style="white-space:pre">        </span>// icon: 'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V2_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> qtip: "Metadata"</div><div><span class="Apple-tab-span" style="white-space:pre">        
        </span> },</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'Mitgliedsgemeinde Grenze',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: Layer_grenzen_mg,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> <span class="Apple-tab-span" style="white-space:pre">        </span>// icon: 'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V3_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> qtip: "Metadata"</div><div><span class="Apple-tab-span"
style="white-space:pre">                </span> }]</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>},</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>text: "LROP / RROP",</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>expanded: true,<span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>children: [</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> text: "LROP", //,layer_RROP</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> expanded: true,<span class="Apple-tab-span" style="white-space:pre">                                        </span> </div><div><span
class="Apple-tab-span" style="white-space:pre">                </span> children: [</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                </span> text:'LROP',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> layer: layer_LROP,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> // <span class="Apple-tab-span" style="white-space:pre">        </span> icon: 'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=wea_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                
        </span> qtip: "LROP"</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> }]</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> ]<span class="Apple-tab-span" style="white-space:pre">                                </span> </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>},</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>text: "DGM",</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>expanded: true,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>children: [</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>
nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'DGM',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: layer_dgm,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> // <span class="Apple-tab-span" style="white-space:pre">        </span> icon: 'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Vorrangstandorte_WEA_RROP08_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> qtip: "DGM"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> }]</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>},</div><div><span class="Apple-tab-span" style="white-space:pre">        
        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>text: "Suchräume",</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>expanded: true,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>children: [</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'layer_suchraumV1',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: layer_dgm,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> <span class="Apple-tab-span" style="white-space:pre">        </span>// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V1_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> qtip: "Metadata"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> },</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'layer_suchraumV2',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: layer_dgm,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> <span class="Apple-tab-span" style="white-space:pre">        </span>// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V2_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> qtip: "Metadata"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> },</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'layer_suchraumV3',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: layer_dgm,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> <span class="Apple-tab-span" style="white-space:pre">        </span>// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V3_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> qtip: "Metadata"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> },</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> nodeType: 'gx_layer',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text:'layer_suchraumV4',</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> layer: layer_dgm,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> <span class="Apple-tab-span" style="white-space:pre">        </span>// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V4_wgs84',</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> qtip: "Metadata"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> }]</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div> ];</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>// create TreePanel</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span></div><div>var layerTree = new Ext.tree.TreePanel({</div><div> text: "Karteninhalt",</div><div> border: true,</div><div> region: "west",</div><div> animate: true,</div><div> height: 500,</div><div> width: 350,</div><div> enableDD:
true,</div><div> split: true,</div><div> autoScroll: true,</div><div> containerScroll: true,</div><div> xtype: "gx_legendpanel",</div><div> showWmsLegend: true,</div><div> loader: new Ext.tree.TreeLoader({</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> applyLoader: false,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> uiProviders: {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> "layernodeui": LayerNodeUI</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> }</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> }),</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> root:
{</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> text: "ZGB GeoPortal",</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> nodeType: "async",</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> children: treeConfig,</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>expanded: true</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> },</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> rootVisible: true,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span> lines: true</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>});</div></font></div></div></div></body></html>