AnsweredAssumed Answered

Launch webmap popup programmatically

Question asked by geonetadmin on May 14, 2013
Latest reply on Jul 24, 2015 by danbrellis
Original User: zconlen

My application consumes a webmap, which is where the popups are designed and configured. A feature of the app is for a user to select an asset from a combo box and the map will zoom to that feature on the map, highlight it and open the popup for that feature. I have the zoom to working, but struggling to get the popup to behave as desired.

I'm calling the show method of infoWindow, like;  

The results vary. If no feature has been identified previously, I get an empty unformated popup.

If a feature has previously been selected, I get the formatted popup, at the correct location, but showing the information for the previous manual identify.

As you can see, in the second scenario, the wrong feature is highlighted, and the information in the popup corresponds to that wrong feature (the pipe to the west), not the manhole which the popup is supposed to be showing. It is positioned correctly though.

It seems that the popup displays information for the "selected" feature. So, perhaps I need to first select the desired feature, but not sure how.

Obviously, I want to avoid trying to programmatically re-create the popup and the highlighting that is used by default in the webmap. Must be an easier way.

Here is the function which is supposed to handle this. Results are from a query task, which will return one feature only:
//Zoom to user selected feature, highlight it and display popup function zoomExtent(results) {   var featureSet = results;   var features = featureSet.features;   var extent = esri.graphicsExtent(features);    //result may be either a line or a point feature. If line feature, the above extent variable is fine. If a point   //feature, that extent is undefined, so we need to create a valid extent   if (!extent) {      var point = features[0];     extent = new esri.geometry.Extent(point.geometry.x - 100, point.geometry.y - 100, point.geometry.x + 100, point.geometry.y + 100, new esri.SpatialReference({ wkid:3857}));     }    //zoom to extent   map.setExtent(extent);   //get location to use for positioning popup   var screenPoint = map.toScreen(extent.getCenter());;   }