Select to view content in your preferred language

Trigger pop-up with Map widget's interactive 'Select' tool - Developer Edition v1.13

1356
6
02-01-2024 10:53 AM
Labels (1)
Yuriko
by
Frequent Contributor

I would like to trigger pop-ups to open when features are selected interactively from the map's 'Select' tool.

The Builder provides the option to 'Show pop-up upon feature selection', but as the more info button states: a "Selection made interactively from the map is excluded".

I have a custom copy of the COTS 'arcgis-map' widget that I can modify to enable this behaviour. Has anyone implemented this?  In general steps, I think I need to listen for a selection change event, get the selected features, and then display the pop-ups.

Yuhash_0-1706813130646.png

 

0 Kudos
6 Replies
JeffreyThompson2
MVP Regular Contributor

First of all, be aware that the select tool is coming as a stand-alone widget in the next update which could potentially make this an OOTB option or at least make this customization easier.

The first problem I see with this idea is that there can only ever be one popup at a time. A popup can contain multiple features from multiple layers, but only one at a single location will ever be displayed at a given time. But the select tool is designed to select many features at once. 

The way I would go about building a widget like this would be combining the Sketch and Features widgets from the JavaScript API. The Sketch widget would be used to draw a shape. When the shape is finished it would trigger a query that would find all the features in that area. And the query would send its results to the Features widget. The final code would be something similar to this example.

https://developers.arcgis.com/javascript/latest/sample-code/highlight-features-by-geometry/

GIS Developer
City of Arlington, Texas
Yuriko
by
Frequent Contributor

Thanks so much for the heads up re: ExB Dev roadmap! 

The pagination action bar appears on top of the pop-up window when there are multiple records clicked on the map, allowing the user to identify the number of records within the click radius and cycle through each feature's pop-up details. 

Yuhash_0-1707185612503.png

There is also a fair bit of pop-up styling via custom HTML so I'm not sure the Feature widget would work for this application, but I'll look into this example! Thanks so much. 

0 Kudos
JeffreyThompson2
MVP Regular Contributor

There is also the Feature (singular) widget. It does not come with all of the extras of the standard popup by default, but it is only designed for a single feature at a time. So to handle multiple features you'll need to create a loop. This is how @RobertScheitlin__GISP's Feature Panel works.

GIS Developer
City of Arlington, Texas
FaithBest
Occasional Contributor

 @Yuriko, did you ever make progress on developing your idea? I am running into the same need and came up with a similar idea, but if youve already done it, then I might ask to follow your path.

0 Kudos
Yuriko
by
Frequent Contributor

Hi @FaithBest , 

As you know the OOTB behaviour of an interactive mouse click on the map isn't easily replicated because of the relationship between pop-ups and selections that Jeffrey outlines above. An interactive click identifies all underlying features from all layers returned in a pagination stack enabling the selection of one feature at a time. But an interactive selection with either the Map widget select tool or stand-alone Select widget selects all features so one needs to manage how the selected features are collected, displayed and paginated through... e.g. should the current pagination index be 'highlighted' or do you de-select them all and re-select the collection one feature at a time? Figured this was a rabbit-hole for another day...

Not sure what your specific scenario is but my focus was on one primary feature layer, and I ended up using Select and List widgets together: the record selection action with the Select widget filters the List features and interactively selecting a feature within the List triggers the popup in the web map. When this app is pushed to production I could provide a link to demo... not sure this helps you at all though 😞

FaithBest
Occasional Contributor

 

@Yuriko @JeffreyThompson2 

Not sure if this is helpful. But just thought I would add that there is now an Enhancement request logged with Esri that may address this issue. 

ENH-000173105: Request the Select widget in ArcGIS Experience Builder Developer Edition include an option to display a pop-up for selected features.

I was told the following: "Esri confirmed that the Select widget does not allow the option to display a pop-up in ArcGIS Experience Builder Developer Edition. However, they mentioned that enabling this functionality is possible through the ArcGIS Maps SDK (The underlying technology behind Experience Builder Developer Edition" 

So hopefully in the future this will be possible. 

0 Kudos