[Users] Customizing Layer Icons for a LayerContainer

Adam Ratcliffe adam at prema.co.nz
Fri Jun 11 04:57:27 CEST 2010


Hi,

I have a TreePanel with a GeoExt.tree.LayerContainer like the one in
this example: http://dev.geoext.org/trunk/geoext/examples/layercontainer.html

For each layer displayed in the Layer Tree I would like to use an icon
based upon a property of the underlying LayerRecord.  I imagine this
is a fairly common use case but I'm struggling to understand how to do
it.  The best I've managed so far is to change the icon for all layers
to the same icon e.g.

                root: new GeoExt.tree.LayerContainer({
                    text: 'Map Layers',
                    loader: {
                        baseAttrs: {
                            iconCls: 'icon_layer',
                            store: layerStore
                        }
                    },
                    layerStore: layerStore,
                    leaf: false,
                    expanded: true
                }),       expanded: true
                }

Cheers
Adam


More information about the Users mailing list