AnsweredAssumed Answered

map info window wont appear

Question asked by pvitt on Dec 14, 2017
Latest reply on Dec 18, 2017 by pvitt

Hi - I'm trying to make a info window appear on my map like the sample shown here: Show an info window | ArcGIS API for JavaScript 3.23 

 

The only difference is that I'm using dojo templates in my app --  my html template (Start.htm) is:

<div>
<div id="mapDivStart" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"
style="width: 100%; height: 100%; margin: 0;">
</div>
</div>

 

my javascript code is:

define([
"esri/map",
"dojo/_base/declare",
"dojo/_base/lang",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin",
"dojo/text!Templates/Start.htm"
], function (
Map,
declare, lang, _WidgetBase, _TemplatedMixin,
_WidgetsInTemplateMixin, StartTpl) {
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
templateString: StartTpl,
map: "",

postCreate: function () {
//map
map = new Map("mapDivStart", {
basemap: "topo",
center: [-117.8, 34.0],
//center: [-122.4, 34.2],
zoom: 9,

});
map.on("load", function () {
map.infoWindow.resize(250, 100);
});

map.on("click", this.addPoint);

},
addPoint:function(evt){
var latitude = evt.mapPoint.getLatitude();
var longitude = evt.mapPoint.getLongitude();
map.infoWindow.setTitle("Coordinates");
map.infoWindow.setContent(
"lat/lon : " + latitude.toFixed(2) + ", " + longitude.toFixed(2) +
"<br>screen x/y : " + evt.screenPoint.x + ", " + evt.screenPoint.y
);
map.infoWindow.show(evt.mapPoint, map.getInfoWindowAnchor(evt.screenPoint));
}

});
});

 

When I debug in the console I get no errors and I see values for all the variables (evt, map, etc..)  The infoWindow just never appears

 

Any idea what could be happening here?  

 

Thanks

Outcomes