I've been spending some time with the JavaScript API, but I'm a little stumped on this one.Most of the samples I have seen simply use the map.graphics GraphicsLayer to hold graphics. In my case, I have added a new GraphicsLayer so that I can hold persistent graphics on the map. I use map.graphics to hold Geocode Results or temporary graphics.What I am trying to do is display the infoWindow for the GraphicsLayer I added to the map, but it's not working as I expected.On page load, after populating my GraphicsLayer, I add it to the map with a defined InfoTemplate.gLayer = new esri.layers.GraphicsLayer();
gLayer.id = "features";
var graphic = new esri.Graphic(new esri.geometry.Polygon(geometry), symbol, attributes, infoTemplate);
gLayer.add(graphic);
map.addLayer(gLayer);
During it's use, someone can search for an address and I add that result to map.graphics. Then try to display the infoWindow after it has zoomed in.var pointMeters = esri.geometry.geographicToWebMercator(geocodeResults[0].location);
map.setExtent(esri.geometry.geographicToWebMercator(geocodeResults[0].bestView));
var onMapZoomHandle = dojo.connect(map, "onZoomEnd", function() {
dojo.disconnect(onMapZoomHandle);
console.log("add result zoomed");
var point = esri.geometry.toScreenPoint(map.extent, map.width, map.height, pointMeters);
map.infoWindow.show(point, map.getInfoWindowAnchor(point)); // throws error
//map.getLayer("features").infoWindow.show(point, map.getInfoWindowAnchor(point));
// tried having layer show directly, long shot, but no go
});
This throws an error and a blank infoWindowexception in animation handler for: onEnd
TypeError: pt is null
[Break on this error] if(!dojo._hasResource["dijit._base.man...h","tr","xx","zh","zh-cn","zh-tw"]);\r\n
arcgis?v=2.1 (line 48
I can click anywhere else on the added GraphicsLayer and get the predefined InfoWindow just fine. Does that InfoWindow display on the map.click() or the graphicsLayer.click()? If so, is there a way I can throw that event after the zoom to mimic the behavior?Thanks.