Mobile Popup Help

528
2
Jump to solution
03-28-2013 04:39 AM
EdwardRozum
New Contributor III
Hi everyone. I am new to this, and have found most of it pretty straight forward, but am having a problem with this bit. I am using my own geocode process to map addresses. Once mapped, I am adding the graphic, and then centering and zooming. All of this works great. The issue I am having is displaying my point information with Popup Mobile. I have been successful using the infoWindow, and the Popup, but not popup mobile. Here is a snippet of my code. Hopefully you all can point me in the right direction.

 //Plot the point and center and zoom to location function MapAddress(data) {     //Map Symobol pin     map.graphics.clear();     var symbol = new esri.symbol.PictureMarkerSymbol('themes/images/Pin.png', 32, 32);      //Popup template     var attributes = { addressLine: data.GeoCodeResults[0].addressLine, city: data.GeoCodeResults[0].city + ", " + data.GeoCodeResults[0].state + " " + data.GeoCodeResults[0].zip,         long: data.GeoCodeResults[0].location.longitude, lat: data.GeoCodeResults[0].location.latitude, matchMsg: data.GeoCodeResults[0].matchMsg     };      //Using This for infoWindow     var infoTemplate = new esri.InfoTemplate("Mapped Address", "Address: ${addressLine}<br />City, State: ${city} ${state} ${zip}<br />Longitude: ${long}<br />Latitude: ${lat}<br />Match Message: ${matchMsg}");      /* Regular Popup - This works when using esri.dijit.Popup     var infoTemplate = new esri.dijit.PopupTemplate({     title: "Mapped Address",     fieldInfos: [     { fieldName: "addressLine", visible: true, label: "Address:" },     { fieldName: "city", visible: true, label: "City, State:" },     { fieldName: "long", visible: true, label: "Longitude:" },     { fieldName: "lat", visible: true, label: "Latitude:" },     { fieldName: "matchMsg", visible: true, label: "Match:" }     ],     showAttachments: false     });*/     //Build point to map     point = esri.geometry.geographicToWebMercator(new esri.geometry.Point(data.GeoCodeResults[0].location.longitude, data.GeoCodeResults[0].location.latitude));     var graphic = new esri.Graphic(point, symbol, attributes, infoTemplate);      //Add to map and zoom     map.graphics.add(graphic);     map.centerAndZoom(point, 12); }
0 Kudos
1 Solution

Accepted Solutions
EdwardRozum
New Contributor III
Solved by adding this line at the bottom of the function:

map.infoWindow.setFeatures([graphic]);

Just in case anyone else has a similar problem

View solution in original post

0 Kudos
2 Replies
EdwardRozum
New Contributor III
Anyone? I have checked the examples and read the api. This seems like it should work. If I am missing something, can anyone let me know what it is. If there is a better way to do this, I am open to suggestions as well.
0 Kudos
EdwardRozum
New Contributor III
Solved by adding this line at the bottom of the function:

map.infoWindow.setFeatures([graphic]);

Just in case anyone else has a similar problem
0 Kudos