Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure_pop_ups() to turn on/off field visibility does not work if you have set popupElements in the JSON #1740

Open
Clubdebambos opened this issue Jan 10, 2024 · 1 comment
Labels

Comments

@Clubdebambos
Copy link

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.

@nanaeaubry
Copy link
Contributor

@Clubdebambos Thank you for reporting this! We will work on fixing it and post any updates here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants