[GIS] Problem with identify task in ArcGIS JavaScript API 2.8

arcgis-javascript-api

I found interesting issue while using the “identify task” tool to display information at a point.

Situation: I am displaying records by Type (A, B, C etc). When I display Type "B" records and I click on anywhere on map, it shows attributes of other records (either "A", "C", or "D")

How is this possible?

Please see the screenshots for further illustration. I also have added the code to JS Fiddle (I changed the server name).

Is this a bug, showing attributes of a hidden record?

Please check this and let me know. Thanks in advance : )

The first screenshot shows all features and an "identify" popup. The second shows only "C"-type records with an identify popup at a location of a different record type.
map showing records of all Types with an identify popup
map showing only "C"-Type records with an identify popup on a different record Type

Update:

I am using single layer and using the combo box to display particular layer. I researched on Google and ESRI forums

Looks like its bug and its ID NIM042441 also it can be resolve according to ESRI forum so working on the same issue..

So thanks to all : )

Best Answer

You have set up your identify parms to search in all layers with the following line of code.

identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL

The identify task doesn't know which layers are visible in your map. In fact it doesn't even need that mapservice to be displayed in the map. And since you have set it to search in all layers, it wouldn't matter.

That's why you are getting results from all layers.