1

I just started working with API Arcgis. I can not find a way to leave open the popup that I add with:

mymap.infoWindow.setContent();

I wish that every click of a POI then opened his infoWindow. Is there a way? Documentation?

0

No reason why it wouldn't be possible to do this, but not sure how ArcGIS folks designed it to work with multiple infowindows. You'll need to be pretty comfortable with JavaScript to pull off this workaround.

I would start with the Popup API. Then probably do something like this:

  • Set a click listener on your map.
  • Query the feature where user clicked. See Query API and FeatureLayer API.
  • Then create a new Popup object for each of those clicks if feature exists.
  • Don't forget to destroy those objects after closing.

Something like this:

map.on('click', function (event) {
  var q = new Query();
  q.geometry = event.mapPoint;
  var d = feature_layer.selectFeatures(q);

  var popup = new Popup(...);
  popup.setFeatures([d]);
});

Hope this works!

0

I discovered the api doesn't allow for this natively as the maps infoWindow object is a singleton. Every new release I was always expecting this to be catered for though...but just never happened.

So I worked around it by sub-classing Popup and ended up putting in a few extra features as I went. Just put it up on Github here:

https://github.com/nickcam/PopupExtended

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.