arcgis-python-api
arcgis-python-api copied to clipboard
configure_pop_ups() to turn on/off field visibility does not work if you have set popupElements in the JSON
Describe the bug Using the configure_pop_ups() method to turn on/off field visibility in a popup does not work if you have set fieldInfos in the popupElements in the JSON.
To Reproduce Steps to reproduce the behavior: The current JSON
"popupInfo": {
"popupElements": [
{
"type": "fields",
"description": "...and a description here.",
"fieldInfos": [
{
"fieldName": "FID",
"isEditable": false,
"label": "FID",
"visible": true
},
{
"fieldName": "REG_NO",
"isEditable": false,
"label": "Registered Number",
"visible": true
}
],
"title": "We added a title here..."
},
{
"type": "relationship",
"description": "Click the related record to see more information.",
"displayCount": 1,
"displayType": "list",
"orderByFields": [
{
"field": "REG_NO",
"order": "asc"
}
],
"relationshipId": 0,
"title": "NIAH Information"
}
],
"relatedRecordsInfo": {
"showRelatedRecords": true,
"orderByFields": [
{
"field": "relationships/0/REG_NO",
"order": "asc"
}
]
},
"fieldInfos": [
{
"fieldName": "FID",
"isEditable": false,
"label": "FID",
"visible": true
},
{
"fieldName": "REG_NO",
"isEditable": false,
"label": "Registered Number",
"visible": true
}
],
"title": "National Inventory of Architectural Heritage"
}
Turn off visibility for FID
from arcgis.gis import GIS
from arcgis.mapping import WebMap
## Access AGOL
agol = GIS("home")
## Access the WebMap Item
wm_item = agol.content.get("WM_ITEM_ID")
## Create a WebMap object from WebMp Item
webmap = WebMap(wm_item)
## turn
field_names = ["FID"]
webmap.configure_pop_ups("NIAH Locations", field_names, False)
webmap.update()
Check the updated JSON
"popupInfo": {
"popupElements": [
{
"type": "fields",
"description": "...and a description here.",
"fieldInfos": [
{
"fieldName": "FID",
"isEditable": false,
"label": "FID",
"visible": true
},
{
"fieldName": "REG_NO",
"isEditable": false,
"label": "Registered Number",
"visible": true
}
],
"title": "We added a title here..."
},
{
"type": "relationship",
"description": "Click the related record to see more information.",
"displayCount": 1,
"displayType": "list",
"orderByFields": [
{
"field": "REG_NO",
"order": "asc"
}
],
"relationshipId": 0,
"title": "NIAH Information"
}
],
"relatedRecordsInfo": {
"showRelatedRecords": true,
"orderByFields": [
{
"field": "relationships/0/REG_NO",
"order": "asc"
}
]
},
"fieldInfos": [
{
"fieldName": "FID",
"isEditable": false,
"label": "FID",
"visible": false
},
{
"fieldName": "REG_NO",
"isEditable": false,
"label": "Registered Number",
"visible": true
}
],
"title": "National Inventory of Architectural Heritage"
}
error: Notice that the fieldInfos towards the bottom of the JSON updated for the FID visibility to false but not in the popupElements. The FID field remains visible in the Popup. Also tried with other fields and other layers but all had the same outcome. The only way the configure_pop_ups() method works is if there are no fieldInfos in the popupElements.
Screenshots If applicable, add screenshots to help explain your problem.
Expected behavior The FID field / fields entered into the configure_pop_ups() method should be turned on/off
Platform (please complete the following information):
- OS: Windows 10
- Browser: Chrome
- Python API Version: 2.2.0.1
Additional context Add any other context about the problem here, attachments etc.
@Clubdebambos Thank you for reporting this! We will work on fixing it and post any updates here