# GeoExt

### Navigation

- GeoExt »
- API Reference »
- Widgets »
- `GeoExt.LegendPanel`

# `GeoExt.LegendPanel`

Extends
  - Ext.Panel
xtype
  `gx_legendpanel`

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.

## Config Options

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

`dynamic`
  `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.

`filter`

  `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`
  `GeoExt.data.LayerStore` The layer store containing layers to be displayed in the legend container. If not provided it will be taken from the MapPanel.

`preferredTypes`
  `Array(String)` An array of preferred legend types.

### Navigation

- index
- modules |
- next |
- previous |
- GeoExt »
- API Reference »
- Widgets »
- `GeoExt.LegendPanel`