[Users] Popup issues

ws0x9 dgrubba at smeinc.com
Mon Oct 16 10:46:53 EDT 2006


I am having a real hard time assigning pop ups to specific markers.  I don't
think that I totally understand how to use the popup functions.  I'm using
ajax to query a spatial database and returning the locations.  In my loop
for the locations I have the following code:

var marker_id = locations[i].getAttribute("id");
var geo_x = locations[i].getAttribute("geo_x").toString();
var geo_y = locations[i].getAttribute("geo_y").toString();

feature = new OpenLayers.Feature("osm_wms",new
OpenLayers.LonLat(geo_x,geo_y));

var store_marker = feature.createMarker();

markers.addMarker(store_marker);

store_marker.events.register("mousedown", feature,function (evt) {
	if (popup == null) {
		popup = feature.createPopup();
		popup.setContentHTML(i);
		popup.setBackgroundColor("yellow");
		popup.setOpacity(0.7);
		markers.map.addPopup(popup);
	} else {
		markers.map.removePopup(popup);
		popup.destroy();
		popup = null;
	}
	Event.stop(evt);
}   );


after the loop I have the remove popup function:

			/**
			 * @param {Event} evt
			 */
			function onPopupMouseDown(evt) {
				markers.map.removePopup(popup);
				popup.destroy();
				popup = null;
				Event.stop(evt);
			}

I have looked through the class reference and the live examples but I just
can't seem to assign the unique popup to the unique marker.  

Thanks for the input in advance.
-- 
View this message in context: http://www.nabble.com/Popup-issues-tf2452737.html#a6835913
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list