Locate a location in a lists

425
12
12-27-2021 08:43 AM
altair
by
New Contributor III

is it possible to have a lists of locations with (latitude and longitude), and if the user click one of the lists it will  locate and a popup will displayed its details?

 

 
0 Kudos
12 Replies
jcarlson
MVP Honored Contributor

Yes, it is possible, but it is dependent upon the context. In a Dashboard or Experience Builder, List widgets are one of the primary means of interacting with data on a linked map.

Where are you trying to implement this?

- Josh Carlson
Kendall County GIS
altair
by
New Contributor III

Hello @jcarlson, thanks for answering, can you please give me an example please.

0 Kudos
altair
by
New Contributor III

arcGIS javascript API

0 Kudos
Kishore
Occasional Contributor

@altair - you can look into the JSAPI sample featurelayer-query-pagination . 

 

Regards,
Kishore
0 Kudos
altair
by
New Contributor III

hello and thanks for this, can you provide an example using my code?

 

0 Kudos
Kishore
Occasional Contributor

@altair - please try implementing and post your code in codepen/sandbox to check or correct for any issue occurred. 

 

Regards,
Kishore
0 Kudos
altair
by
New Contributor III

@Kishore please see the updated question

 

0 Kudos
Kishore
Occasional Contributor

@altair - change the code for correct feature with attributes:

const onLocationSelect = (location) => {
              mapDiv.current.goTo(location).then(() => {                      
           mapDiv.current.popup.open({
                  features:[location],
                  location:[
                      location.longitude,
                     location.latitude,
                  ]
            })
     })
};

This should work for you.

Regards,
Kishore
0 Kudos
altair
by
New Contributor III

@Kishore Unfortunately it doesnt work

 

0 Kudos