AnsweredAssumed Answered

How to manage multiple features in PopupTemplate

Question asked by sl5337 on Jun 18, 2018
Latest reply on Jun 19, 2018 by sl5337

I am using PopupTemplate to display feature attributes to the user when a graphic is clicked. In order to have maximum control over the format of the content I am using the "function" method of creating the content. This method is shown in the "PopupTemplate with promise" sample code. I ended up implementing it almost exactly the same as this sample, minus the StatisticDefinition components which I did not need.

 

So basically, the function I created for the PopupTemplate content makes its own call to the REST service, transforms the feature attributes returned from the REST service into HTML, and returns that content to the PopupTemplate. This works great as long as there are no overlapping features. 

 

If more than one feature is returned from the REST service call, then the PopupTemplate shows the navigation buttons as it should, for example, "1 of 2", and allows the user to navigate forward and backward between the features. However, I cannot find any documentation regarding how to supply the content to the PopupTemplate so that it actually switches between the attributes of the different features as the user navigates. The sample that I worked from shows how to create a single content string to supply the content of the PopupTemplate.  This works fine for a single feature, but I don't see any way to supply the PopupTemplate with content for multiple features if the user clicks a graphic with overlapping features.

 

Obviously the PopupTemplate "knows" that there are multiple features to display because it creates the navigation buttons automatically. How can I format the content from multiple features so that the PopupTemplate switches between the content for each feature as the user navigates through the features?

 

I'm using the ArcGIS 4.7 JavaScript library.

Outcomes