Select to view content in your preferred language

Order of fields in PopupTemplate

701
4
07-08-2022 05:35 AM
PHerk
by
Emerging Contributor

We need to build a kind of popup, but completely custom made.

I need specific fields that I get from the feature layer by using the PopupTemple:

 

for (var i = 0; i < featurelayer.popupTemplate.fieldInfos.length; i++) {
var fieldname = featurelayer.popupTemplate.fieldInfos[i].fieldName;
}

 

Important is the sort order of the fields and for most feature layers the sort order is the same as set in the AGOL portal.

When I use the standard ESRI popup, view.popup, the sort order is for most maps the same, and follows the AGOL portal setting. On some maps I have a different sort order. The sort order in the AGOL portal is the same as the sort order in view.popup, but different in my 'feature layer.popupTemplate.fieldInfos'. I cannot find the reason why it is sometimes different. Any ideas? How can I get the correct AGOL sort order information so I can manage to sort myself instead of following the fieldInfos array natural sort order?

0 Kudos
4 Replies
DawnMcCall
Occasional Contributor

@PHerk  Did you ever get any resolution to this?

0 Kudos
PHerk
by
Emerging Contributor

@DawnMcCall , no. I had more questions about unexpected behaviour, but most of my questions are not answered...

0 Kudos
DawnMcCall
Occasional Contributor

We are not seeing inconsistent results, but more of the configuration order not being respected.  So, when the order is configured in the popup setting in the map service, and we call a popup, the order is respected, but when we call the attributes outside the popup, the order is alphabetical and not respecting the popup configurations.  Have you seen anything like that?

0 Kudos
PHerk
by
Emerging Contributor

That is the problem I have too. I do not see any ordering data/information, so there I don't know how to solve this.

0 Kudos