AnsweredAssumed Answered

Correct attribute is not showing up when I click a polygon

Question asked by cara.mayo_noaa on Jul 25, 2018
Latest reply on Jul 26, 2018 by kenbuja

I am building a map that you can hover over and click on. I need to access a feature's project number (ProjectNum) when I click on it, but my click event on the layer doesn't seem to be firing. When I click the map, I get all of the feature layer's project numbers, not the one that I want. I've tried using map.on, on(layer, "click"...), layer.on("click"... How do I retrieve the specific project number of the polygon that I click on? 

 

function clickMap(){     layer.on("update-end", function(evt){        console.log(evt);        map.on("click", function(e){        console.log(e);        console.log("project number: " + layer.graphics[0].attributes.ProjectNum);        });    })}

Attachments

Outcomes