[OpenLayers-Dev] "beforefeatureunselected" Vector layer event

Alexandre Dube adube at mapgears.com
Mon Mar 21 13:53:55 EDT 2011


Hi,

   I'm currently working on a GeoExt.ux editing tool using a bunch of 
existing other ux and OpenLayers controls.  Among those things, I'll 
have a SelectFeature control to be able to choose which feature to edit 
(obviously).  But, I'd like to be able to stop the user from unselecting 
a feature if it has unsaved changes and show a "save changes ?" message 
of some sort.  The two ways I thought of accomplishing this is to :

  a) do not allow the user to unselect a feature at all ( clickout: 
false and toggle: false ), which is more a workaround the issue... or

  b) add a new "beforefeatureunselected" event to the 
OpenLayers.Layer.Vector object, listen to it in the SelectFeature 
control (in the unselect method) and register a callback method that 
would return false if the feature has unsaved changes and stop the 
feature from being unselected in the Control.

   Does that make sense ?

Thanks,

-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Dev mailing list