LCaraway LCaraway - 6 months ago 34
Javascript Question

ESRI - Return Attributes when Feature Is Clicked

I would like to be able to click on an individual feature point and have it return a specific value of a specific attribute associated with the point clicked. I do not need an info template as to display this value on the map but rather need the value to make a call to a separate service. Is the attributes and their values stored in the layer? Where?

// onclick handler for meters.
dojo.connect(Lyr, "onClick", function (evt) {




If you're using the 3.x version of the JavaScript API, and your layer type is FeatureLayer, here is how you would get that info:

on(lyr, 'click', function(evt) {
    alert('objectid is: ' + evt.graphic.attributes.objectid + '. echelon is ' + evt.graphic.attributes.echelon);

The documentation is here, and a sample app is here. Hope this helps!