OpenLayers.Strategy.Save - OpenLayers

# OpenLayers.Strategy.Save

A strategy that commits newly created or modified features. By default the strategy waits for a call to save before persisting changes. By configuring the strategy with the auto option, changes can be saved automatically.

#### Inherits from

- OpenLayers.Strategy

Summary

OpenLayers.Strategy.Save | A strategy that commits newly created or modified features.
Properties |
events | {OpenLayers.Events} An events object that handles all events on the strategy object.
auto | {Boolean | Number} Auto-save.
Constructor |
OpenLayers.Strategy.Save | Create a new Save strategy.
Functions |
activate | Activate the strategy.
deactivate | Deactivate the strategy.
save | Tell the layer protocol to commit unsaved features.

### Properties

### events

{OpenLayers.Events} An events object that handles all events on the strategy object.

#### Register a listener for a particular event with the following syntax

>     strategy.events.register(type, obj, listener);

#### Supported event types

start | Triggered before saving
success | Triggered after a successful transaction
fail | Triggered after a failed transaction

### auto

{Boolean | Number} Auto-save. Default is false. If true, features will be saved immediately after being added to the layer and with each modification or deletion. If auto is a number, features will be saved on an interval provided by the value (in seconds).

### Constructor

### OpenLayers.Strategy.Save

Create a new Save strategy.

#### Parameters

options | {Object} Optional object whose properties will be set on the instance.

### Functions

### activate

> activate: function()

Activate the strategy. Register any listeners, do appropriate setup.

#### Returns

{Boolean} The strategy was successfully activated.

### deactivate

> deactivate: function()

Deactivate the strategy. Unregister any listeners, do appropriate tear-down.

#### Returns

{Boolean} The strategy was successfully deactivated.

### save

> save: function( | features | )

Tell the layer protocol to commit unsaved features. If the layer projection differs from the map projection, features will be transformed into the layer projection before being committed.

#### Parameters

features | {Array} Features to be saved. If null, then default is all features in the layer. Features are assumed to be in the map projection.

> activate: function()

Activate the strategy.

> deactivate: function()

Deactivate the strategy.

> save: function( | features | )

Tell the layer protocol to commit unsaved features.
{Boolean | Number} Auto-save.
Abstract vector layer strategy class.
Close