Select to view content in your preferred language

How can I change the order of popups on an ArcGIS Online Map

29310
52
Jump to solution
10-03-2014 01:15 PM
bshepard
Regular Contributor

I have 3 layers (2 point and 1 line) that coincide, let's call them A, B, and C.  I have tried several things to get the popup order to be A (1 of 3), B,(2 of 3), C (3 of 3): ordering the layers in Content with A on top, then B, then C; renaming them so that they are in alphabetical order; creating copies of the layers in a specific order.  No matter what I try, the popups appear in the order B, A, C.  They don't seem to order in the order they appear in Content or the Legend, alphabetically, or in order of creation/modification.  Is there any way to force one layer's popup to display 1st, or specify the order in which the popups display?

Tags (2)
52 Replies
JCGuarneri
Frequent Contributor

I know this is a very old post, but here's my workaround for the most recent versions of Enterprise (11.1+) and for AGOL. In Arcade, you can use Now(), DateDiff(), and a while loop to force a given popup to take longer.

This is a really jankety solution, but it works. I recommend using it only if really necessary. It would also work best if there's only one or two popups in particular that you really want to move further down in the pile. Anything more than that would be really hairy to manage well.

Here's the code to do this:

//set target delay in milliseconds
var delay = 1000;

//get start time and initiate the elapsed time variable
var startTime = Now();
var time2 = Now();
var elapsed = DateDiff(time2,startTime);
//while elapsed time is less than target time, check elapsed time until target is met
while (elapsed < delay) {
          elapsed = DateDiff(Now(),startTime);
    
}
//return value for testing. Can use functional code instead
return elapsed;

 

AndresCastillo
MVP Regular Contributor

Thank you for this cool code.

I set this code to the attribute expressions options of the layer's popup I wanted to delay, but this did not work as expected.

Instead, the popup was delayed completely for all the layers for the set time, but still returned the order from the server response.

I am using enterprise portal 11.2

0 Kudos
AndresCastillo
MVP Regular Contributor

main clarification for me is that I thought network calls happened each time a feature is clicked, but seems the popup uses the already returned/cached data on the map.

This explains why if the undesired layer loaded first on the map, even if setting the delay on the popup, the map already pre-decided that layer and popup order, based on the server response speed.

0 Kudos