Selecting data to highlight custom widget

169
3
2 weeks ago
HarryBonshor-Mayes
New Contributor II

Hello!

I'm currently using a custom widget to display objectids and attachment counts from a connected data source.

I'm looking for a way to click on the div containing the object id and have it highlight this data in the same way it would in a table. This way the other elements of the experience builder should dynamically update to select this point, so the map will zoom to, the table will highlight and the attachment viewer will display the attachments.

Any help with this is appreciated, thanks!

Tags (2)
0 Kudos
3 Replies
JeffreyThompson2
MVP Regular Contributor

Take a look at this code sample to see how to add and remove highlights from a feature.

https://developers.arcgis.com/javascript/latest/sample-code/widgets-feature/

GIS Developer
City of Arlington, Texas
0 Kudos
HarryBonshor-Mayes
New Contributor II

This seems to be for live updating on a hover.

This is the layout of my custom widget using object IDs and displaying small attachment previews:

HarryBonshorMayes_0-1715084054957.png

I want to be able to add an <a> to each row in here so that it acts like the table widget as shown here:

HarryBonshorMayes_1-1715084117837.png

The idea is to have the map update to a zoomed view using the ObjectID and highlight it in the table too. 

Is this possible from a custom widget?

 

0 Kudos
JeffreyThompson2
MVP Regular Contributor

You can add an onClick event to the JSX element in your list. In the function triggered by the click event, use a goTo() function to zoom the map.

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo

GIS Developer
City of Arlington, Texas
0 Kudos