Folks
I am using
Layer.on("Click", function (evt){ var testval = evt.graphic.attributes.ADDRESS }
to return the Feature value of the "ADDRESS" field.
testval results are fine.
My issue is I need to pass in a different Field each time a new FeatureLayer is activated.
I have the name of the Field prior to the on Click event.
What is the syntax....
fld = "NAME"; Layer.on("Click", function (evt){ var testval = "evt.graphic.attributes." + fld; }
Alternative ideas welcome.
Thanks,
Keith
Solved! Go to Solution.
Keith,
Try:
fld = "NAME"; Layer.on("Click", function (evt){ var testval = evt.graphic.attributes[fld]; }
Keith,
Try:
fld = "NAME"; Layer.on("Click", function (evt){ var testval = evt.graphic.attributes[fld]; }
Thank you Robert!