Hi,
Our application require us to provide functionality similar to what the LayerSwitcher does, but with the added functionality of reordering layers. I implemented this using ExtJS TreePanel. It works pretty weel with the exception that the map never updates even after I issue a layer.redraw(true) command. Below is the code:
function layerControl() {
var map = Map1.GetOpenLayersMap();
var store = new GeoExt.data.LayerStore({
map: map,
layers: map.layers
});
var layerList = new GeoExt.tree.LayerContainer({
layerStore: store,
leaf: false,
expanded: true
});
var layerTree = new Ext.tree.TreePanel({
enableDD: true,
root: layerList,
listeners: {
'checkchange': function(node, checked) {
var overlay = map.getLayer(node.layer.name);
overlay.visibility = checked;
overlay.initVisibility = checked;
overlay.redraw(true);
}
}
});
var win = new Ext.Window({
title: 'Layer Configuration',
width: 200,
height: 180,
layout: 'fit',
items: [layerTree],
buttonAlign: 'center',
buttons: [
{ text: 'Apply' },
{ text: 'Close',
handler: function() {
win.close();
}
}]
});
win.show();
}
Any help is greatly appreciated
Thanks
Chris