Select to view content in your preferred language

Custom popup content and actions?

628
2
02-24-2022 09:42 AM
Fox71
by
New Contributor

Hello,

I am using a json layer to load all my markers on my map. These markers need a different popup template based on the information  they provide, usually based on a "type" attribute. Also, I want to customize the footer actions based on the type of marker being clicked on.

I have not found a good example online yet.

Any help appreciated.

Thank you,

Ben

0 Kudos
2 Replies
KristianEkenes
Esri Regular Contributor

You can use Arcade to conditionally create popup elements. Here's some documentation about this: https://developers.arcgis.com/javascript/latest/arcade/#popup-element

 

I wrote a blog post about how to create Arcade elements for cluster popups. The concept is the same as layer popups. This example here: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/summarize-and-explore-point-clusters... shows how to create content conditional on the feature. 

 

Can you provide more details with an example of the type of content you would need to display given the type of feature?

0 Kudos
Fox71
by
New Contributor

Thank you for your response.
It's pretty basic. The map has some simple location markers.

For the different popup content, an example is markers representing buildings will have a popup content formatted differently form the markers representing an office location. The json file provides several ways to call the different markers (by category and type).

As for the custom actions, as an example, some markers are bus stops and I don't want to show any footer on the popup. The building actions will a direction button probably, and the office actions would have directions as well as a website url button if one is provided for an office.

My first thought was to create different jsonlayer and create multiple popuptemplates for each case. But I feel there is a better solution.

I'll check your links.

Thanks!

Ben

0 Kudos