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

Godfrey, David A TRAN:EX David.Godfrey at gov.bc.ca
Thu Jul 22 19:26:29 EDT 2010


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100722/ec8f7262/attachment.html


More information about the Users mailing list