[OpenLayers-Users] Unable to Rollback changes on WFS update failure

Adrian Popa adrian_gh.popa at romtelecom.ro
Fri Jul 23 02:12:37 EDT 2010


Hello,

It seems to me that you're not checking the problem where you're 
supposed to.
onCommit returns the reply from the server, so it's the server's job to 
accept or reject the changes. If the server rejects the changes, you can 
do just this.layer.refresh({force: true}); and you will get the old data 
(and the new data will be discarded).

Good luck

On 07/23/2010 02:26 AM, Godfrey, David A TRAN:EX wrote:
>
> Hi,
>
> I'm trying to create an editable map based upon the OpenLayers 
> wfs-protocol-transactions example. On some occasions (for example when 
> other users have updated features) I want to abandon the outstanding 
> edit on a feature and redraw it as it was originally obtained from the 
> base WFS service. I couldn’t work out how to do that and have reverted 
> to trying to redraw the entire layer using the layer.redraw and 
> layer.refresh functions. Unfortunately nothing seems to work. The 
> features stay as drawn, which no longer matches what is in the 
> geoserver service. How do I do some equivalent of "undo this feature 
> and cancel any pending changes on it", or alternatively “refresh this 
> feater (or if necessary all features) from the WFS service. The code 
> fragment I have at this point is:
>
>     var saveStrategy = new OpenLayers.Strategy.Save
>
> ({
>
> onCommit: function(response)
>
> {
>
> if (response.success())
>
> {
>
> alert("Good");
>
> alert(response.priv.responseText);
>
> } else  {
>
> alert("Bad");
>
> alert(response.priv.responseText);
>
> }
>
> if (confirm("Do you want to abort this request ?"))
>
> {
>
> alert("Abort request here");
>
> this.layer.refresh(true);
>
> this.layer.redraw();
>
> }
>
> }
>
> });
>
>     wfs = new OpenLayers.Layer.Vector("Editable Features", {
>
>         strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
>
>         AND SO ON...
>
> Any Suggestions ?
>
> David G.
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>    


-- 
---
Adrian Popa
NOC Division
Network Engineer
Divizia Centrul National de Operare Retea
Departament Transport IP&  Metro
Compartiment IP Core&  Backbone
Phone: +40 21 400 3099

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100723/eca1ca07/attachment.html


More information about the Users mailing list