# GeoExt

### Navigation

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

# `GeoExt.data.FeatureStore`

Extends
  - Ext.data.Store

class `GeoExt.data.``FeatureStore`
  A store containing `GeoExt.data.FeatureRecord` entries that optionally synchronizes with an `OpenLayers.Layer.Vector`.

## Example Use

Sample code to create a store with features from a vector layer:

    var store = new GeoExt.data.FeatureStore({
        layer: myLayer,
        features: myFeatures
    });

## Config Options

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

`featureFilter`
  `OpenLayers.Filter` This filter is evaluated before a feature record is added to the store.

`features`
  `Array(OpenLayers.Feature.Vector)` Features that will be added to the store (and the layer if provided).

`initDir`
  `Number` Bitfields specifying the direction to use for the initial sync between the layer and the store, if set to 0 then no initial sync is done. Default is `GeoExt.data.FeatureStore.LAYER_TO_STORE|GeoExt.data.FeatureStore.STORE_TO_LAYER`.

`layer`
  `OpenLayers.Layer.Vector` Layer to synchronize the store with.

`reader`
  `Ext.data.DataReader` The reader used to produce records from objects features. Default is `GeoExt.data.FeatureReader`.

## Public Methods

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

`FeatureStore.``bind`()

  Parameter: | layer – `OpenLayers.Layer` Layer that the store should be synchronized with.

  Bind this store to a layer instance, once bound the store is synchronized with the layer and vice-versa.

`FeatureStore.``getRecordFromFeature`()

  Parameter: | feature – `OpenLayers.Vector.Feature`
  Returns: | `GeoExt.data.FeatureRecord` The record corresponding to the given feature. Returns null if no record matches.

  Get the record corresponding to a feature.

`FeatureStore.``unbind`()
  Unbind this store from the layer it is currently bound.

### Navigation

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