[OpenLayers-Users] open popup in open layers from external list

Bijoy K. Anupam bijoya at rediff.co.in
Mon Oct 6 03:04:19 EDT 2008


Hi Leo,

I exactly have the same problem. And, I don't know if this can be done.
Currently, my work is on hold in this direction :-(

If you find any solution on this, please share this with me too... :)

<BIJOY>

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Leo
Sent: Sunday, October 05, 2008 6:27 PM
To: users at openlayers.org
Subject: [OpenLayers-Users] open popup in open layers from external list


Hi to all, I have a map with a lot of marker. Every marker is added by the
function at the bottom. All works very well and i can see all marker in the
map with its popup if i click on it. Now I would create a popup window with
an html list of all markers in the map and if i click an item i want the
marker associated in the map opens its popup.
I've looked in the example, but i can't find the solution. Is there a way to
do what i need?

Thank you very much for your help!

function addMarker(ll, popupClass, popupContentHTML, closeBox, overflow,
iconID) {        
				
				var size = "";
				var offset = "";
				var icon = "";
				switch (iconID)
				{				
					case 1:
					{
						size = new
OpenLayers.Size(17,29);
	    		        offset = new OpenLayers.Pixel(-(size.w/2),
-size.h);				
						icon = new
OpenLayers.Icon(\'./templates/images/GREEN.png\',size,offset);
					}break;				
					case 2:
					{
						size = new
OpenLayers.Size(8,8);
	    		        offset = new OpenLayers.Pixel(-(size.w/2),
-size.h);				
						icon = new
OpenLayers.Icon(\'./templates/images/listitem.png\',size,offset);
					}break;
					case 3:
					{
						size = new
OpenLayers.Size(17,29);
	    		        offset = new OpenLayers.Pixel(-(size.w/2),
-size.h);				
						icon = new
OpenLayers.Icon(\'./templates/images/RED.png\',size,offset);
					}break;
					default:
					{
						size = new
OpenLayers.Size(17,29);
	    		        offset = new OpenLayers.Pixel(-(size.w/2),
-size.h);				
						icon = new
OpenLayers.Icon(\'./templates/images/AQUA.png\',size,offset);
					}break;
				}
									
				
				var feature = new
OpenLayers.Feature(markers, ll, {icon: icon});

				
            	feature.closeBox = closeBox;
	            feature.popupClass = popupClass;
	            feature.data.popupContentHTML = popupContentHTML;
	            feature.data.overflow = (overflow) ? "auto" : "hidden";

                    
    	        var marker = feature.createMarker();


        	    var markerClick = function (evt) {
            	    if (this.popup == null) {
                	    this.popup = this.createPopup(this.closeBox);
                   	 	map.addPopup(this.popup);
                   		this.popup.show();
                	} else {
                    	this.popup.toggle();
	                }
    		         currentPopup = this.popup;
            	    OpenLayers.Event.stop(evt);
            	};
	            marker.events.register("mousedown", feature,
markerClick);					

    	        markers.addMarker(marker);				

        	}
-- 
View this message in context:
http://n2.nabble.com/open-popup-in-open-layers-from-external-list-tp1298733p
1298733.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list