[Users] opacity slider in a bbar - trouble connecting to selected layer
Eoin Mac Aoidh
eoinyp at yahoo.com
Tue Jul 27 10:51:46 CEST 2010
Hi list,
I have a tree containing the layers in my map. It has a bbar with a button to remove a selected layer from the map. Following this template, I am trying to also add in an opacity slider for the selected layer in the bbar: So that you can either remove a selected layer, or change its opacity.
I am having trouble connecting the slider to the selected layer.
I suspect at least some of the problem is with the line:
"layer: tree.getSelectionModel().getSelectedNode().layer"
I would appreciate any help regarding how to connect the selected layer with the slider.
Many Thanks,
Eoin
The following is the code I have:
var tree = new Ext.tree.TreePanel({
region: "center", //NBNBNBNB centER
title: "Map Layers",
width: 200,
autoScroll: true,
enableDD: true,
lines: false,
rootVisible: false,
root: new GeoExt.tree.LayerContainer({
layerStore: mapPanel.layers,
expanded: true
}),
bbar: [{
text: "Remove from Map",
handler: function() {
var node = tree.getSelectionModel().getSelectedNode();
if(node) {
map.removeLayer(node.layer);
}
}
},{
xtype: "gx_opacityslider",
layer: tree.getSelectionModel().getSelectedNode().layer,
aggressive: true,
horizontal: true,
width: 120,
plugins: new GeoExt.LayerOpacitySliderTip()
}
]
});
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100727/2060b6d2/attachment.htm
More information about the Users
mailing list