[OpenLayers-Dev] Trigger save event

Eric Lemoine eric.lemoine at camptocamp.com
Thu Jul 23 02:40:12 EDT 2009


On Thu, Jul 23, 2009 at 8:29 AM, jessisena<jessica.sena at scpec.net> wrote:
>
> The problem is that in the ticket about Save.js, you declared and trigger on
> commit these two new events:
>
> EVENT_TYPES: ["start","success", "fail"],
> ...
> this.events.triggerEvent("success", evt);
>
> In my client I have a layer, which is the listener of the event "success",
> like this:
>
>               var saveStrategy = new OpenLayers.Strategy.Save();
>
>                wfs = new OpenLayers.Layer.Vector("Editable Features", {
>                strategies: [saveStrategy],
>                projection: new OpenLayers.Projection("EPSG:23031"),
>                styleMap: styles,
>                featureNS :  "http://opengeo.org",
>                eventListeners: {
>                        "success": savesuccess,
>                },
>            });
>
> But this layer never receives the event, although the commit action takes
> place correctly. I suppose I'm missing something, but I don't understand
> what.

The listener must be set in the save strategy:

var s = new OpenLayers.Strategy.Save({
    eventListeners: {
        success: savesuccess
    }
};

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Dev mailing list