Hi all,

I want to add an combobox into layerNode to set opacity for each layer, I
have extended GeoExt.tree.LayerNodeUI:

[code]
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.insertAfer(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">1</option>',
'</select>'
].join(""));
 this.opacityCB = opacitySelect;
this.opacityCB.on("change", function(value) {alert(value);}, this);
    },

});
[/code]

But I don't know how to use it, I have tree layer:

[code]
var tree = new Ext.tree.TreePanel({
                root: new GeoExt.tree.LayerContainer({
                    expanded: true,
    uiProvider: aic.tree.LayerNodeUIOpacity
                }),
                rootVisible: true,
                useArrows: true,
                autoScroll: true,
                animate: true,
                enableDD: true,
                expanded: true,
                layout: "fit",
                border: false
            });
[/code]

But it don't work, it say:


   1. Uncaught TypeError: Cannot call method 'getVisibility' of undefined
      1. 
GeoExt.tree.LayerNodeUI.Ext.extend.renderGeoExt.js:224<http://localhost/aic40/js/geoext/GeoExt.js>
      2. aic.tree.LayerNodeUIOpacity.Ext.extend.render
      
LayerNodeUIOpacity.js:15<http://localhost/aic40/js/aic/tree/LayerNodeUIOpacity.js>
      3. 
Ext.tree.TreeNode.Ext.extend.renderext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      4. 
Ext.tree.TreePanel.Ext.extend.renderRootext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      5. 
Ext.tree.TreePanel.Ext.extend.afterRenderext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      6. Ext.extend.renderext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      7. 
Ext.layout.ContainerLayout.Ext.extend.renderItemext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      8. 
Ext.layout.ContainerLayout.Ext.extend.renderAllext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      9. 
Ext.layout.ContainerLayout.Ext.extend.onLayoutext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      10. 
Ext.layout.FitLayout.Ext.extend.onLayoutext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      11. 
Ext.layout.ContainerLayout.Ext.extend.layoutext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      12. 
Ext.Container.Ext.extend.doLayoutext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      13. 
aic.MapApps.Ext.extend.initMapaicapp.js:341<http://localhost/aic40/js/aicapp.js>
      14. 
Ext.Ajax.request.successaicapp.js:157<http://localhost/aic40/js/aicapp.js>
      15. 
Ext.extend.handleResponseext-all.js:7<http://localhost/aic40/js/ext/ext-all.js>
      16. fext-base.js:7<http://localhost/aic40/js/ext/adapter/ext/ext-base.js>
      17. mext-base.js:7<http://localhost/aic40/js/ext/adapter/ext/ext-base.js>
      18. (anonymous
function)ext-base.js:7<http://localhost/aic40/js/ext/adapter/ext/ext-base.js>



I think I set uiProvider not correct, where I can set it?

thank you very much.

-- 
Nguyễn Đình Toán
_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev

Reply via email to