# GeoExt

### Navigation

- GeoExt »
- API Reference »
- `GeoExt.data` »
- `GeoExt.data.LayerStore`

# `GeoExt.data.LayerStore`

Extends
  - Ext.data.Store

class `GeoExt.data.``LayerStore`
  A store that contains a cache of `GeoExt.data.LayerRecord` objects.

## Example Use

Sample to create a new store containing a cache of `GeoExt.data.LayerRecord` instances derived from map layers.

    var store = new GeoExt.data.LayerStore({
        map: myMap,
        layers: myLayers
    });

## Config Options

Configuration properties in addition to those listed for Ext.data.Store.

`fields`
  `Array` If provided a custom layer record type with additional fields will be used. Default fields for every layer record are layer (`OpenLayers.Layer`) title (`String`). The value of this option is either a field definition objects as passed to the `GeoExt.data.LayerRecord.create()` function or a `GeoExt.data.LayerRecord` constructor created using `GeoExt.data.LayerRecord.create()`.

`initDir`
  `Number` Bitfields specifying the direction to use for the initial sync between the map and the store, if set to 0 then no initial sync is done. Defaults to `GeoExt.data.LayerStore.MAP_TO_STORE|GeoExt.data.LayerStore.STORE_TO_MAP`

`layers`
  `Array(OpenLayers.Layer)` Layers that will be added to the store (and the map, depending on the value of the `initDir` option.

`map`
  `OpenLayers.Map` Map that this store will be in sync with. If not provided, the store will not be bound to a map.

`reader`
  `Ext.data.DataReader` The reader used to produce `GeoExt.data.LayerRecord` objects from `OpenLayers.Layer` objects. If not provided, a `GeoExt.data.LayerReader` will be used.

## Public Properties

Public properties in addition to those listed for Ext.data.Store.

`LayerStore.``map`
  `OpenLayers.Map` Map that the store is synchronized with, if any.

### Navigation

- index
- modules |
- next |
- previous |
- GeoExt »
- API Reference »
- `GeoExt.data` »
- `GeoExt.data.LayerStore`