Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using GeoExt to create a tree. In each node I want the corresponding image at left instead of the default image default image like this site. How can I do it?

Edit

I found this example but I don't know how can I add childrens

Edit 2

This is part of my code:

var bpn = new OpenLayers.Layer.WMS("bpn", 
    url,
    {
        LAYERS: [ 'Año 2004', 'Año 2005', 'Año 2006', 'Año 2007', 'Año 2009'],
        format: "image/png",
        transparent: "true",
        projection: 'EPSG:4326'
     },
     {
         buffer: 0, 
         displayOutsideMaxExtent: true,
         isBaseLayer: false,
         displayInLayerSwitcher: false,
         yx: {'EPSG:4326' : true}
      });

var treeConfig = [
    {
        nodeType: "gx_layer",
        layer: bpn,
        isLeaf: false,

        loader: {
            param: "LAYERS",

        },
        expanded: false
    }];

tree = new Ext.tree.TreePanel({
    border: true,
    region: "west",
    title: "Entre Ríos",
    width: 250,
    split: true,
    collapsible: true,
    collapseMode: "mini",
    autoScroll: true,

    loader: new Ext.tree.TreeLoader({
        applyLoader: true,
        uiProviders: {
            "layernodeui": LayerNodeUI
        }
    }),
    root: {
        nodeType: "async",
        children: treeConfig
    },     
    rootVisible: false,
    lines: false,
});

Each layer (node)'Año 2004', 'Año 2005', 'Año 2006', 'Año 2007', 'Año 2009' has a different image. What should I change in treeConfig?

share|improve this question
add comment

1 Answer 1

For each of your nodes add an iconCls option, the iconCls refers to some css

nodeType: "gx_layer", layer: "xyz", iconCls: "cc_xyz",

and the css might look like this

.cc_xyz { background-image: url( /_images/parcel_sm.png ) !important; }

share|improve this answer
    
Please see Edit 2 Thank you! –  Overflow012 Jul 24 '13 at 13:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.