Select to view content in your preferred language

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

30219
54
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)
54 Replies
AxelLévy
Regular Contributor

Please fix it

RhettZufelt
MVP Notable Contributor

even if the popup is slower, don't think the users will mind that much to get the data they are after.

I mean, after all, they've already waited for what seems like forever for hosted feature layer to load......

AndyBills
Occasional Contributor

Agreed - Esri should allow the popup order to be defined. I'd be happier explaining to users that the popup is 'slow' or 'slower' (whatever the actual delay is) due to underlying data being searched in order to return the correct popup, than to irritate with an unwanted popup that cannot even be moved out the way - AND which has the arrow to the next feature move due to the differences between popup content.

It's like a mean game where the user is plagued with unwanted popups that are fiddly to use!

Simply ridiculous that an organisation such as Esri cannot see how poor the popups are.

IanPeebles
Frequent Contributor

Funny I came across this thread because I was looking to change the order of the popups.  To my disappointment, I learned it cannot be done.  I agree that it would be extremely nice to be able to re-order the popups within a javaScript application.

ESRI...can you please consider this functionality?  We need more controls on what we can and can not do with popups.  Also, allow for easily changing the pixel tolerance on when a user clicks to identify a popup in the mobile environment.  Now you have to tap...tap..tap..until you get lucky enough to activate the popup when clicking on a point.

JamesMadden1
Frequent Contributor

I've had a bit of success getting the popups reordered in the PopupManager's _onSelectionChange function but it seems like the more logical place to make the update would be where the queries to the layers are made.  I assume ESRI's logic loops through all the map layers to make the queries asynchronously.  Any idea what script/function handles that logic (the query to return features for the popup)?

This issue is probably the biggest complaint we get from our end users.  Our internal GIS people love the way the popups return everything but I think it overwhelms our main user base.  It seems like the majority of web mapping api's only return a popup for the feature on top.  Perhaps ESRI can provide an option to only select from the feature that is drawn on top at the point where the user clicks?

MalcolmJ
Frequent Contributor

7 years now since this topic was raised and still no solution (unless you're a developer).... come on ESRI!

MattAnderson4
New Contributor

I agree that this is a problem.  It is not faster to have to click through a bunch of results that you don't care about to get to the ones you do.

BrittanyBurson
Frequent Contributor

Would be great these days to have this functionality to enable control over the order of features returned on a map tap in Field Maps, so that the primary feature of interest shows up first. 

Edit: if you're reading this in 2021, be sure to upvote the Idea here.

JulioGarrido
Occasional Contributor

OK...  here we are about 8 years since the question was posed to this forum.  Still, we are waiting on, what I think, to be a simple fix to this issue.  Either add a selectable global pop-up order based on the layer list or integrate a manually entered order number into the pop-up configuration.   ESRI states the pop-up order is based on a first-come-first-serve methodology to improve the speed of the online map.  I believe we as GIS Directors, Coordinators, Techs, and Analysts can make an online map that can function quickly and provide the necessary information to our users at the same time.  We can disable unnecessary pop-ups if they are hindering the speed of the online map.  ESRI should not make that decision for us.  We need this functionality. 

JamesMadden1
Frequent Contributor

This is possible using the developer edition.  Follow the steps below.

 

FYI - I got the below snippets off a similar thread a few years back but I can't seem to find the link.  The code below will work for WAB but you probably should consider moving to Experience Builder/4.X.  I'm not sure how much additional support the 3.X builder will be getting before it is retired.

 

(1) Open the popupmanager.js file

(2) Add "this.reorderPopupFeatures();" at the end of the init method

(3) Add the two methods listed below to the popupmanager.js file. 

reorderPopupFeatures: function() {
var that = this;
this.layerStructrue = LayerStructure.getInstance();

aspect.around(this.popupUnion.bigScreen, "setFeatures", function(originalSetFeatures) {
return function(featuresArg, options) {
var convertedFeatureDefs = [];


array.forEach(featuresArg, function(featureOrDef) {
if(featureOrDef.declaredClass === "esri.Graphic") {

var def = new Deferred();
def.resolve([featureOrDef]);
convertedFeatureDefs.push(def);
} else {

convertedFeatureDefs.push(featureOrDef);
}
});

this.clearFeatures();
all(convertedFeatureDefs).then(lang.hitch(this, function(results) {
var features = [];
array.forEach(results, function(result) {
array.forEach(result, function(feature) {
if(feature) {

var featureAlreadyExist = array.some(features, function(f) {
if(feature === f) {
return true;
} else {
return false;
}
});

if(!featureAlreadyExist) {
features.push(feature);
}
}
});
}, this);


var orderedFeatures = that.sortFeatures(features);


originalSetFeatures.apply(this, [orderedFeatures, options]);
}));

};
});


aspect.around(this.popupUnion.bigScreen, 'show', function(originalShow) {
return function(location/*, options*/) {
originalShow.apply(this, [location, false]);
};
});

aspect.around(this.popupUnion.mobile, 'show', function(originalShow) {
return function(location/*, options*/) {
originalShow.apply(this, [location, false]);
};
});
},


sortFeatures: function(features) {
if(!this.layerOrderPriority) {

this.layerOrderPriority = {};
var priority = 1;
this.layerStructrue.traversal(lang.hitch(this, function(layerNode) {
this.layerOrderPriority[layerNode.id] = priority++;
}));
}


if(!this.layerStructureChangeHandler) {
this.layerStructureChangeHandler = this.layerStructrue.on('structure-change', lang.hitch(this, function() {
this.layerOrderPriority = null;
}));
}

array.forEach(features, function(feature) {
if(feature && feature.getLayer) {
feature._priority = this.layerOrderPriority[feature.getLayer().id];
} else {
feature._priority = 100000;
}
}, this);


features.sort(function(featureA, featureB) {
if(featureA._priority > featureB._priority)
{ return 1;}
else
{ return -1;}
return 0;
});

return features;
},