I am using infowindow to display the results of identifyTask that has two layers from my map service so it returns multiple features.
The infowindow has more button in each feature it identifies so that when I click the more button I get the data of current feature. How can I get the current selected feature? I am using this example.
I want to get incase the popup identifies more than one feature to get current feature How can this be done.

1 Answer 1


For the map.infoWindow, you can either access the entire list of selected graphics by working with map.infoWindow.features, or you can get the current selected feature using map.infoWindow.getSelectedFeature(). This returns a graphic, and you can get the data on that graphic by looking at graphic.attributes.

function getMoreInfo() {
  var graphic = map.infoWindow.getSelectedFeature();

  // do something with the data inside the graphic

If you want to know when the selected feature is changed in the infoWindow, and you're using an API version 3.4 or later (when the Popup was made the default infoWindow), you'll need to set up a listener to the infoWindow's "selection-change" event. Here's how you could do it using dojo/on.

dojoOn(map.infoWindow, "selection-change", getMoreInfo);
  • How do you know when the user has clicked the arrow to select a different feature? InfoWindow appears to only have show/hide events.
    – Josh Werts
    Aug 13, 2014 at 11:39
  • If you're you're using the Popup InfoWindow, which was made default back in v3.4, you can listen to the infoWindow's "selection-change" event. developers.arcgis.com/javascript/jsapi/…. I'll update my answer
    – raykendo
    Aug 13, 2014 at 13:58
  • Ah, you're absolutely correct. I'm using a webmap from ArcGIS Online and had not made the mental connection that map.infoWindow is an instance of PopUp. I was just looking at the docs for esri.dijit.InfoWindow wondering why there wasn't a whole lot there. I tested "selection-change" in this case and it worked. Thanks!
    – Josh Werts
    Aug 14, 2014 at 13:09

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .