GeoExt

Table Of Contents

Previous topic

GeoExt.state

Next topic

Ext Overrides

GeoExt.state.PermalinkProvider

Extends
class GeoExt.state.PermalinkProvider(config)
Create a permalink provider.

Example Use

Sample code displaying a new permalink each time the map is moved.

// create permalink provider
var permalinkProvider = new GeoExt.state.PermalinkProvider();

// set it in the state manager
Ext.state.Manager.setProvider(permalinkProvider);

// create a map panel, and make it stateful
var mapPanel = new GeoExt.MapPanel({
    renderTo: "map",
    layers: [
        new OpenLayers.Layer.WMS(
            "Global Imagery",
            "http://maps.opengeo.org/geowebcache/service/wms",
            {layers: "bluemarble"}
        )
    ],
    stateId: "map",
    prettyStateKeys: true // for pretty permalinks
});

// display permalink each time state is changed
permalinkProvider.on({
    statechanged: function(provider, name, value) {
        alert(provider.getLink());
    }
});

Config Options

Configuration properties in addition to those listed for Ext.state.Provider.

encodeType
Boolean Specifies whether type of state values should be encoded and decoded. Set it to false if you work with components that don’t require encoding types, and want pretty permalinks. Defaults to true.

Public Methods

Public methods in addition to those listed for Ext.state.Provider.

Parameter:baseString The base URL, optional.
Returns:String The permalink.

Return the permalink corresponding to the current state.