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?
Solved! Go to Solution.
Just echoing the chorus - not being able to control pop-up order is a drag. And TOC order would be Far better than no control. Processing speed isn't the same in 2023 as it was in 2014 when this is was first posted (!).
Happy 2024...here's some good news to kick off the new year. ESRI has indicated they're updating the underlying framework (the ArcGIS Maps SDK for JavaScript) to display features in layer order in its next release (targeted for February of this year). See also this page, although below is the relevant text for future reference:
The Popup and Features widgets now display features from multiple layers in the order they are displayed in the map. This means that the features of the topmost layer in the map will appear first, followed by the features of the next layer, and so on. In previous versions, the features were displayed in the order they were returned from the server.
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;
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
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.