Change the order of features in popups in 4.x JS API

11-27-2020 02:59 PM
New Contributor III

The layers in my map often have many overlapping features and when the popup is opened I'd like to be able to order them by a field in order to have the most relevant features at the top of the stack.  Was able to find an older 3.x example of this, but I can't find the equivalent for 4.x.  Any suggestions?  No need to rewrite this for me, just point me to the right object/method/event if it exists, thanks!

connect.connect(map.infoWindow, "onSetFeatures", function () {  
            var orderedFeatures = [];  
            for(var i = 0; i< map.infoWindow.features.length; i++) {  
                if (map.infoWindow.features[i] === 'ImportantLayer') {  
                else {  
            map.infoWindow.features = orderedFeatures;  


0 Replies