Problem with Feature Layer queryFeatures

928
2
06-02-2014 06:50 AM
ReneeMaxwell
Occasional Contributor
I recently updated my application to JSAPI 3.9 and I noticed that the queryFeatures method on Feature Layers is not working as expected. It will not return all feature attributes and does not honor the 'outFields' property for the Feature Layer or for the query. The only attribute field that is returned is the one set as the display field.

I am able to work around this by using a Query Task, which returns the attribute fields as set in the Feature Layer outFields property. I was able to use the queryFeatures method prior to switching to version 3.9, so I suspect this is a bug.

Has anyone else has encountered this issue?
0 Kudos
2 Replies
Noah-Sager
Esri Regular Contributor
Hi Renee,

I haven't encountered this issue before, but I do know that setting outFields works if you wait for the feature layer to be loaded before performing the query. Are you able to upload a simple sample application (or code snippet) that reproduces this issue?

-Noah
0 Kudos
ReneeMaxwell
Occasional Contributor
Thank you Noah! That was in fact the problem. I had been firing the query after the map.on("layers-add-result") event, and had forgotten that I moved the query outside of this event when I was debugging another error. It is working fine now.
0 Kudos