Changing default popup template appearance and location

311
1
02-08-2024 12:38 AM
JonathanAttard
New Contributor II

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',
      // }
    }

 

 

 

 

1 Reply
FredericPoliart_EsriAU
Occasional Contributor II

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.