How to show multiple popups simultaneously

1850
6
06-14-2021 12:25 AM
SelectivelySocial
New Contributor III

Hello,

So I want to show the co-ordinates of multiple points clicked by user on a map in the popup content, but I am able to open just one popup at a time, this example https://developers.arcgis.com/javascript/latest/sample-code/intro-popup/ also shows one popup at a time, I want the same functionality in the above example but with multiple popups, is there a way to achieve this ?

Thanks.

0 Kudos
6 Replies
BlakeTerhune
MVP Regular Contributor

A popup is referring to a specific feature in the  map. When multiple features are clicked to initiate a popup, there is just an overflow arrow at the top corner to allow showing the next or previous feature one at a time. Here's a sample.

If you want to cumulatively show information from a collection of features, you probably just want to display that information in a div and position it using the view's UI. You can populate the contents of the div with hitTest(), writing the coordinates in some useful format into the results div as they come in.

0 Kudos
SelectivelySocial
New Contributor III

The problem with using View's UI is that it's not attached to the map, that is it doesn't stick to the map point but rather the screen point, so when a user drags the map or zoomins/zoomouts it's not ideal.

So is there a way to avoid this issue ?

0 Kudos
BlakeTerhune
MVP Regular Contributor

I think in that case you'll need to listen for a click event to capture the coordinate that was clicked, then use the GraphicsLayer to display a TextSymbol of the coordinate value. Graphics in the map are fixed to a certain location and move with the map. You'll also probably want a button on the UI for clearing the GraphicsLayer.

0 Kudos
ReneRubalcava
Frequent Contributor

The popup by design is a single popup at a time. Like Blake said above, the popup will let you paginate multiple features. But if you want to display more than one popup content, you can use the Feature widget and display them somewhere else on the page like this sample that displays multiple Feature widgets.

https://developers.arcgis.com/javascript/latest/sample-code/widgets-feature-multiplelayers/

SelectivelySocial
New Contributor III

No this is not what I wanted, I just need to display the co-ordinates for the point clicked on the map and this solution is not at all ideal for that.

0 Kudos
VictorBerchet
Occasional Contributor

Any luck with this ?

 

I am also trying to instantiate a popup but it doesn't show up on the map 😞

0 Kudos