AnsweredAssumed Answered

Version 3.4 map's infoWindow coords, anchor and fixed anchor are undefined

Question asked by aconnolly on May 2, 2013
Latest reply on Sep 3, 2013 by aconnolly
Take the following code and notice that in the browser's javascript console that the map info window's coords, anchor and fixed anchor properites are 'undefined'. Why?

Am I using the info window incorrectly? Does this have anything to do with it not having a symbol associated with it? The docs don't make it at all clear what I might be doing wrong.

<!DOCTYPE html> <html>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>     <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />     <!--The viewport meta tag is used to improve the presentation and behavior of the samples       on iOS devices-->     <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>     <title>Info Window Tests</title>          <!-- ESRI Required -->     <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css" />     <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/dojo/dijit/themes/tundra/tundra.css"/>     <script type="text/javascript">var dojoConfig = { parseOnLoad: true };</script>     <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4"></script>         <script type="text/javascript">          dojo.require("esri.map");          var map;         var streetsUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";          function init() {              var initExtent = new esri.geometry.Extent({ "xmin": -13646149, "ymin": 3606604, "xmax": -12393805, "ymax": 4232776, "spatialReference": { "wkid": 102100} });                          map = new esri.Map("map", { extent: initExtent });              var layer0 = new esri.layers.ArcGISTiledMapServiceLayer(streetsUrl, { "id": "Streets", "opacity": 1.0, "visible": true });              var BASE_MAP_ARRAY = [layer0];             map.addLayers(BASE_MAP_ARRAY);              dojo.connect(map, "onLoad", function (map) { map.infoWindow.resize(250, 100); });             dojo.connect(map, "onClick", addPoint);             dojo.connect(map.infoWindow, "onShow", onInfoWindowShown);         }          function addPoint(evt) {              map.infoWindow.setTitle("Coordinates");                          //Need to convert the coordinates from the map's spatial reference (web mercator) to geographic to display lat/lon values             var geoPt = esri.geometry.webMercatorToGeographic(evt.mapPoint);             map.infoWindow.setContent("lat/lon : " + geoPt.y.toFixed(2) + ", " + geoPt.x.toFixed(2) + "<br />screen x/y : " + evt.screenPoint.x + ", " + evt.screenPoint.y);             map.infoWindow.show(evt.mapPoint, map.getInfoWindowAnchor(evt.screenPoint));          }          function onInfoWindowShown() {              logMessage("info window coords: " + map.infoWindow.coords);             logMessage("info window anchor: " + map.infoWindow.anchor);             logMessage("info window fixed anchor: " + map.infoWindow.fixedAnchor);             logMessage("info window isShowing: " + map.infoWindow.isShowing);         }          function logMessage(message) {              // Check for a console object             var console = window['console'];              // Log a message if a log property is available             //---------------------------------------------             if (console && console.log) {                  console.log(message);             }         }          dojo.ready(init);      </script>   </head>   <body class="claro">     <div id="map" style="width:1024px; height:512px; border:1px solid #000;"></div>   </body> </html>


**EDIT**

This is not associated with there being a symbol or a renderer on a graphics layer to which the info window points. I was able to reproduce this problem in a separate application that has both symbols and renderers. The map infoWindow's coords property is always undefined. What am I doing wrong?

Outcomes