Table Of Contents

Previous topic


Next topic



class GeoExt.LegendPanel(config)

A panel showing legends of all layers in a layer store. Depending on the layer type, a legend renderer will be chosen.

The LegendPanel will include legends for all the layers in the layerStore it is configured with, unless the layer is configured with displayInLayerSwitcher: false, or a layer record has a hideInLegend field with a value of true. Additional filtering can be done by configuring a filter on the LegendPanel.

Config Options

Configuration properties in addition to those listed for Ext.Panel.

Boolean If false the LegendPanel will not listen to the add, remove and change events of the LayerStore. So it will load with the initial state of the LayerStore and not change anymore.

Function A function, called in the scope of the legend panel, with a layer record as argument. Is expected to return true for layers to be displayed, false otherwise. By default, all layers will be displayed.

filter: function(record) {
    return record.getLayer().isBaseLayer;
layerStore The layer store containing layers to be displayed in the legend container. If not provided it will be taken from the MapPanel.
Array(String) An array of preferred legend types.