How to open popup window when map loaded?

827
3
02-25-2012 11:16 PM
ShaharBukra
New Contributor III
for example i have only 1 point on the map with InfoTemplate set.
i want to open the popup when the map initialize and not when the the user click the point.

how can i invoke the action that open/shows the infoTemaplate??...



                        // Create the point with picture marker symbol
   var sym = new esri.symbol.PictureMarkerSymbol('http://files.softicons.com/download/toolbar-icons/vector-icon-set-1-by-bevelandemboss.net/png/48/pin.png', 50, 50);

   // set the coordinate
   var graphic =new esri.Graphic({"geometry":{"x":34.784763,"y":32.07707,"spatialReference":{"wkid":4326}}});

   // set the symbol
   graphic.setSymbol(sym);

   // Create the pop up for the symbol, (HTML Format)
   var infoTemplate = new esri.InfoTemplate();
    infoTemplate.setTitle("Test");
   infoTemplate.setContent("Body Test");
   graphic.setInfoTemplate(infoTemplate);
  
   // Add the graphic to the map
   map.graphics.add(graphic);


Thank you,
Shahar Bukra.
0 Kudos
3 Replies
EdSaunders
Occasional Contributor
Hi Shahar,  you would need to call the function once the map is loaded.  Something like:

dojo.connect(map, "onLoad", function() {
     map.infoWindow.show(point);
});


Obviously you would need to set the location of point before it fires.
0 Kudos
ShaharBukra
New Contributor III
Thanks for your replay,
i already tried it and it open blank infoWindow at the top right corner, even when i set the location.

map.infoWindow.show({"geometry":{"x":34.784763,"y":32.07707,"spatialReference":{"wkid":4326}}});

any ideas?
0 Kudos
ShaharBukra
New Contributor III
any ideas?
0 Kudos