I'm using ArcGIS JavaScript API to display a map with a feature layer with multiple records.enter image description here
I wrote code to display a pop up when a record is selected on the map. Is it possible to change the color of the selected record to some other color by updating the renderer when its clicked on and persist the change?
I know the Javascript Api highlights the boundary when a record is clicked on but it doesnt persist, when another record is clicked the previous clicked record go backs to its original color.
-
1You can use the map's graphics layer and define your own renderer. The features will persist until you remove them.crmackey– crmackey2018年06月05日 04:10:20 +00:00Commented Jun 5, 2018 at 4:10
-
Do i need to pass the geometry of the record to the graphics layer?Ravi– Ravi2018年06月05日 17:45:57 +00:00Commented Jun 5, 2018 at 17:45
1 Answer 1
If you're using the version 4.x ArcGIS API for JavaScript, you can use the highlight functionality. Here is a demo (click on a feature).
-
Awesome thank you. I'm not using 4.x version but ill upgrade for this very feature.Ravi– Ravi2018年06月06日 19:06:55 +00:00Commented Jun 6, 2018 at 19:06
-
In the 3.x version it should be easier - you want to add an extra FeatureLayer but make it in
MODE_SELECTION
and then onClick add or remove the feature from being "selected".GavinR– GavinR2018年06月07日 14:38:39 +00:00Commented Jun 7, 2018 at 14:38 -
When i just use your jsfiddle and update feature layer URL, the highlight feature isn't working. Do i need edit any of my FeatureServer properties?Ravi– Ravi2018年06月07日 17:57:30 +00:00Commented Jun 7, 2018 at 17:57
Explore related questions
See similar questions with these tags.