Hi guys,
I am going to use this sample to select features on my map and display attributes in my custom html table, so for the first step i want to show selected results in console.log().
In 269 line i added console.log(results.features.attributes.unit_name) , but it returns undefined.
How can i get selected features attributes?
Thanks
Solved! Go to Solution.
@Vakhtang_Zubiashvili - Please add following code to display the attributes:
results.features.forEach((feature)=>{console.log(feature.attributes["unit_name"]);});
You cannot get the attributes for the collection. you have to loop through the array and display the attribute values.
@Vakhtang_Zubiashvili - you code pen sample is not working as you share the editor URL. please share the code her to check.
Thanks Kishore, i have changed link.
@Vakhtang_Zubiashvili - Please add following code to display the attributes:
results.features.forEach((feature)=>{console.log(feature.attributes["unit_name"]);});
You cannot get the attributes for the collection. you have to loop through the array and display the attribute values.
Thanks Kishore,
But after i do other features selection, it returns previous selection + current selection, i want to get only current selection 😞
Clear the graphics before you draw the sketch. add following in line 219
polygonGraphicsLayer.removeAll();
Thanks Kishore, it works like a charm ❤️