Thank you,
I have just finish it.
LayerNodeUIOpacity.js file:
[code]
/**
* Layer Node UI with Opacity combobox in order to change the opacity of
layer.
*/
Ext.ns("aic.tree");
aic.tree.LayerNodeUIOpacity = Ext.extend(GeoExt.tree.LayerNodeUI, {
/**
* Contructor method
*/
constructor: function(config) {
aic.tree.LayerNodeUIOpacity.superclass.constructor.apply(this,
arguments);
},
render: function(bulkRender) {
aic.tree.LayerNodeUIOpacity.superclass.render.apply(this,
arguments);
//add combobox
var cb = this.checkbox;
var opacitySelect = Ext.DomHelper.insertAfter(cb, [
'<select class="c-tree-node-opacity">',
'<option value="0">0</option>',
'<option value="0.2">0.2</option>',
'<option value="0.4">0.4</option>',
'<option value="0.6">0.6</option>',
'<option value="0.8">0.8</option>',
'<option value="1" selected="selected">1</option>',
'</select>'
].join(""));
this.opacityCB = Ext.get(opacitySelect);
this.opacityCB.on("change", function(evt, combo, opts) {
this.node.layer.setOpacity(combo.value);
}, this);
},
});
[/code]
css:
.c-tree-node-opacity {
height: 18px;
margin: 0px 2px 0px 2px;
}
input.x-tree-node-cb {
margin-bottom: 2px;
}
and use it:
[code]
...
var tree = new Ext.tree.TreePanel({
root: new GeoExt.tree.LayerContainer({
expanded: true,
loader: new GeoExt.tree.LayerLoader({
applyLoader: false,
store: this.mapPanel.layers,
uiProviders: {
"layerNodeUI": aic.tree.LayerNodeUIOpacity
},
baseAttrs: {
uiProvider: "layerNodeUI"
}
})
}),
rootVisible: true,
useArrows: true,
autoScroll: true,
animate: true,
enableDD: true,
expanded: true,
layout: "fit",
border: false
});
...
[/code]
thank you.
On Mon, Mar 21, 2011 at 3:19 PM, Eric Lemoine
<[email protected]>wrote:
> On Mon, Mar 21, 2011 at 4:13 AM, Toan Nguyen <[email protected]> wrote:
> > Hi all,
> > I want to add an combobox into layerNode to set opacity for each layer,
>
> Hi
>
> Note that GeoExt now includes a specific TreePanel plugin for that:
> GeoExt.plugins.TreeNodeComponent. See
> <http://dev.geoext.org/docs/lib/GeoExt/plugins/TreeNodeComponent.html>.
>
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : [email protected]
> http://www.camptocamp.com
>
--
Nguyễn Đình Toán
_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev