Highlighting country by country name (and not by tapping on the map)

491
2
Jump to solution
06-13-2022 08:38 AM
ericca
by
New Contributor II

Good day,

I have these two requirements:

  1. Tapping a country (or multiple countries) on a map highlights the country and selects rows for that country on a data grid.
  2. Tapping on the data grid selects the row and highlights the country (of the selected row) on the map.

I'm able to achieve requirement #1 with the codes specified in - https://developers.arcgis.com/javascript/latest/sample-code/effect-blur-shadow/

But for #2, I can't seem to find an api that will accept country name of country fid nor any post about this.

The code in the link uses:

var query = {
   geometry: view.toMap(event),
   returnGeometry: true,
   outFields: ["*"]
};

featureLayer.queryFeatures(query);

But on the next requirement, the input country will be from the selected row and not a coordinate from the map.

Anyone know if there's another API for this or if this is possible?

Here's my test page - 

ericca_0-1655134698815.png

 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
ericca
by
New Contributor II

Hi Jill,

I'm using a regular html table which displays business data.

I was able to resolve the requirement above though using Query object. Here's a sample code:

queryObject = new Query();
queryObject.where = "COUNTRY = '" + selectedCountry + "'";
queryObject.returnGeometry = true;
queryObject.outFields = ["*"];

query.executeQueryJSON(queryUrl, queryObject).then(function (results) {
	if (results.features) {
		graphicsLayer.graphics.add(results.features[0]);
	}
});

 

Thanks!

View solution in original post

0 Kudos
2 Replies
JillianStanford
Occasional Contributor III

Hi,

Are you using the FeatureTable widget?

This sample demonstrates how to select a feature using the map or the table -

FeatureTable widget with a map 

Jill

0 Kudos
ericca
by
New Contributor II

Hi Jill,

I'm using a regular html table which displays business data.

I was able to resolve the requirement above though using Query object. Here's a sample code:

queryObject = new Query();
queryObject.where = "COUNTRY = '" + selectedCountry + "'";
queryObject.returnGeometry = true;
queryObject.outFields = ["*"];

query.executeQueryJSON(queryUrl, queryObject).then(function (results) {
	if (results.features) {
		graphicsLayer.graphics.add(results.features[0]);
	}
});

 

Thanks!

0 Kudos