[Users] GeoExt Legend Tree and base layers ?

karsten vennemann karsten at terragis.net
Thu Jan 6 01:12:13 CET 2011


Hi all,
 
have a GeoExt Legend Tree below and wanted to enable more base layers to be shown (no legend needed for those in) it too. The one below work already with OSM  and shows up as a radio button. Now I would like to add back into my app google and yahoo base layers. However, if I just add them to Openlayer the tree does not show anything any more. 
What do I need to change in my tree legend below to enable base layers otehr than OSM to work. I tried adding a nodeType: "gx_baselayercontainer"   but could not gte it to work. It will be something like in http://api.geoext.org/1.0/examples/tree.html but with legend icons ...
 
I have this :
 
        var tree = new Ext.tree.TreePanel({
            title: "Ebenen",
            width: 250,
            autoScroll: true,
            enableDD: true,
            // apply the tree node component plugin to layer nodes
            plugins: [{
                ptype: "gx_treenodecomponent"
            }],
            loader: {
                applyLoader: false,
                uiProviders: {
                    "custom_ui": LayerNodeUI
                }
            },
            root: {nodeType: "gx_layercontainer",
                loader: {
                    baseAttrs: {
                        uiProvider: "custom_ui"
                    },
                    createNode: function(attr) {
                        // add a WMS legend to each node created
                        attr.component = {
                            xtype: "gx_wmslegend",
                            layerRecord: mapPanel.layers.getByLayer(attr.layer),
                            showTitle: false,
                            // custom class for css positioning
                            // see tree-legend.html
                            cls: "legend"
                        }
                        return GeoExt.tree.LayerLoader.prototype.createNode.call(this, attr);
                    }
                }
            },
            rootVisible: false,
            lines: false
        });
 
Thanks
Karsten 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110105/954fb63b/attachment.htm 


More information about the Users mailing list