Hi All,
I am trying to add a draggable marker to the map at a random point after the page has loaded and the user has performed a specific action.
I start by creating a SimpleMarkerLayer and adding it to the map sans any markers.
So far so good...
So, first I tried adding the marker client side. When the user performed the event, I, via the OpenLayers API, grabbed a handle to the Marker Layer and added a new marker. This showed the marker but unfortunately it seemed to break something on the map (for example I have a callback method to toggle a color ortho layer that stopped working) and threw an error when I tried to drag it. So, for giggles, I added a draggable marker in the middle of nowhere (not visible) prior to rendering the map (on page load). This allowed me to drag the marker, but threw an error when you released it and still sort of broke the map (zooming and panning still works).
Next attempt - when the user performed the event I perform a callback and add the marker server side. This is the version that works if it I use a postback rather than a callback. Debugging on subsequent callbacks show that the map retains the marker information, but via the OpenLayers API the marker layer does not show it in the marker array, even after forcing a redraw via the redraw method on the layer. Since the marker is attached to the map on subsequent callbacks, it seems everything is working, but for some reason the layer is not refreshing...
So - my questions are this:
1) Should I be able to add draggable markers client side? If so, how?
2) If not, how do I force the client side map to refresh and draw the marker with callbacks?
The page that the map lives on is pretty complex with several user controls and callbacks. As I said above, if I use a postback to add the marker to the map everything works - but I really can't do this for various reasons (I probably could if I REALLY had to but I REALL don't want to).
Sorry for the long post!
ThinkGeo - if you want some code please let me know!
Thank you,
Justin