<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi list,<br>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.<br>I am having trouble connecting the slider to the selected layer. <br>I suspect at least some of the problem is with the line: <br>
"layer: tree.getSelectionModel().getSelectedNode().layer"<br>
I would appreciate any help regarding how to connect the selected layer with the slider.<br>Many Thanks,<br>Eoin<br><br>The following is the code I have:<br><br>var tree = new Ext.tree.TreePanel({<br> region: "center", //NBNBNBNB centER<br> title: "Map Layers",<br> width: 200,<br> autoScroll: true,<br> enableDD: true,<br> lines: false,<br> rootVisible: false,<br> root: new GeoExt.tree.LayerContainer({<br> layerStore: mapPanel.layers,<br> expanded:
true<br> }),<br> bbar: [{<br> text: "Remove from Map",<br> handler: function() {<br> var node = tree.getSelectionModel().getSelectedNode();<br> if(node) {<br> map.removeLayer(node.layer);<br> }<br> }<br>
},{<br> xtype: "gx_opacityslider",<br> layer: tree.getSelectionModel().getSelectedNode().layer,<br> aggressive: true,<br> horizontal: true,<br> width: 120,<br> plugins: new GeoExt.LayerOpacitySliderTip()<br> }<br> ]<br> });<br><br><br><br><br></td></tr></table><br>