Select to view content in your preferred language

Changing default popup template appearance and location

992
2
02-08-2024 12:38 AM
JonathanAttard
Occasional Contributor

I am working with ArcGIS Developer to modify the position and content of the popup.

 

Would it be possible to change the default template into something custom? Since I'd rather change this internally from the code than changing the popup Arcade code for every layer I have.

 

Another question is whether I could dock the popup to a section or something like that. The 'bottom-left' and other options would not satisfy this since I need it to be in a specific location within the portal.

 

To solve these, would it instead be possible to intercept the popup click, read which layers and open a custom version instead?

 

I have found the following popup code within the widget arcgis-map/runtime/components/mapbase.tsx:

 

 

 

    mapViewOption.popup = {
      defaultPopupTemplateEnabled: true,

      // Not changing since overwritten by popupTemplate ?
      title: "Results title",
      content: 'test',

      // ADDED
      // dockOptions: {
      //   position: 'bottom-left',
      // }
    }

 

 

 

 

2 Replies
FredericPoliart_EsriAU
Frequent Contributor

The best is to edit a smart popup in your web-map itself. 

  • in Portal, select and edit your web map > open in Map Viewer
  • select one layer
  • in properties > edit POPUP 
  • Add a text content
    FredericPoliart_EsriAU_0-1707726527752.png
  • Edit , use hyperlinks, or even image <img> 

  • Click that "source" button and save it in plain text (good old notepad)

    FredericPoliart_EsriAU_1-1707726609319.png
  • Save your web-map

  •  

    Back in Experience Builder,  add a "Feature Info" widget and place it (say) in a side panel

  • Select your layer and tick "respect the source" (meaning 'use the popup as designed in my webmap ')
  •  

    FredericPoliart_EsriAU_2-1707726853138.png

     

  • Select your webmap widget in ExB, and scroll all the way down in the parameters
    FredericPoliart_EsriAU_3-1707726974773.png
  • turn OFF the "enable popup" - i know - it's counter intuitive but it tells ExB to NOT display the floating popup on the map.  BUT it will send the selection to your Feature Info widget.


Try with the simplest web map and simplest ExB test project , first. 

 

PaulLandman
Emerging Contributor

Thank you for this Frederic.  I have tried this, nearly successfully.

However when I first open the Experience, the Feature Info box  that I have now created to replace the popup, starts by showing the first of all the records in the entire table as a default view:

PaulLandman_0-1739878077529.png

 

When I select an individual record it does correctly display the pop up for that address, but I need it to be blank before any records are selected.

Have I missed a simple setting somewhere?

I am using Experience Builder on AGOL.

Thanks.

0 Kudos