mapfish. widgets. data. SearchStoreMediator

This class is to be used when one wants to insert search results (features) in a store; it works by listening to “crudfinished” and “clear” events triggered by a <mapfish.Protocol.TriggerEvent> protocol.

Usage example

var protocol = new mapfish.Protocol.TriggerEventDecorator({
    protocol: new mapfish.Protocol.MapFish({
        url: "web_service_url"
    })
});
var store = new Ext.data.Store({
    reader: new mapfish.widgets.data.FeatureReader(
        {}, [{name: "name", type: "string"}]
    )
});
var mediator = new mapfish.widgets.data.SearchStoreMediator({
    store: store,
    protocol: protocol,
    filter: function(feature) {
        return feature.state != OpenLayers.State.UNKNOWN;
    },
    append: false // store is cleared before new features are added into it
});
Summary
mapfish. widgets. data. SearchStoreMediatorThis class is to be used when one wants to insert search results (features) in a store; it works by listening to “crudfinished” and “clear” events triggered by a <mapfish.Protocol.TriggerEvent> protocol.
Constructor
mapfish. widgets. data. SearchStoreMediatorCreate an instance of mapfish.widgets.data.SearchStoreMediator.
Properties
protocol{mapfish.Protocol.TriggerEventDecorator} The trigger event decorator protocol.
append{Boolean} False if the store must be cleared before adding new features into it, false otherwise; defaults to true.
filter{Function} a filter function called for each feature to be inserted, the feature is passed as an argument to the function, if it returns true the feature is inserted into the store, otherwise the feature is not inserted.
autoActivate{Boolean} True if the mediator must be activated as part of its creation, false otherwise; if false then the mediator must be explicitely activate using the activate method; defaults to true.
Functions
activateActivate the mediator.
deactivateDeactivate the mediator.

Constructor

mapfish. widgets. data. SearchStoreMediator

Create an instance of mapfish.widgets.data.SearchStoreMediator.

Parameters

config{Object} A config object used to set the search store mediator’s properties (see below for the list of supported properties), and configure it with the Ext store; see the usage example above.

Returns

{mapfish.widgets.data.SearchStoreMediator}

Properties

protocol

{mapfish.Protocol.TriggerEventDecorator} The trigger event decorator protocol.

append

{Boolean} False if the store must be cleared before adding new features into it, false otherwise; defaults to true.

filter

{Function} a filter function called for each feature to be inserted, the feature is passed as an argument to the function, if it returns true the feature is inserted into the store, otherwise the feature is not inserted.

autoActivate

{Boolean} True if the mediator must be activated as part of its creation, false otherwise; if false then the mediator must be explicitely activate using the activate method; defaults to true.

Functions

activate

activate: function()

Activate the mediator.

Returns

{Boolean}False if the mediator was already active, true otherwise.

deactivate

deactivate: function()

Deactivate the mediator.

Returns

{Boolean}False if the mediator was already deactive, true otherwise.
Decorator class responsible to trigger events when requests are sent and received.
activate: function()
Activate the mediator.
deactivate: function()
Deactivate the mediator.
Create an instance of mapfish.widgets.data.SearchStoreMediator.
Close