AnsweredAssumed Answered

IdentifyTask - complete event

Question asked by bforbhavin on Aug 18, 2014
Latest reply on Apr 24, 2015 by bforbhavin

I wrote following code to show GIS attributes, whenever user clicks on the map. But IdentifyTask - complete event is being called multiple times. I am using ArcGIS JS API 3.9. I am able to see from the fiddler that REST request is fired only once and able to retrieve multiple features attributes. Sometimes, I have seen it is being called single time only even attributes are multiple. How to debug on this inconsistent behavior?

 

vMap.on('click', function(event){

  var vIdentifyTask,

  vIdentifyParams,

  vIdentifyTaskDeferred;

 

 

  vIdentifyTask = new IdentifyTask(url),

  vIdentifyParams = new IdentifyParameters();

 

  vIdentifyParams.tolerance = 3;

  vIdentifyParams.returnGeometry = true;

  vIdentifyParams.layerIds = [3,4];

  vIdentifyParams.width = vMap.width;

  vIdentifyParams.height = vMap.height;

  vIdentifyParams.geometry = event.mapPoint;

  vIdentifyParams.mapExtent = vMap.extent;

  vIdentifyTask.on('complete', showAttributesPopup);

  vIdentifyTask.on('error', showError);

 

  vIdentifyTask.execute(vIdentifyParams);

 

 

  function showAttributesPopup(featureResults) {

      //this function is being called multiple times

  }

function showError() {

}

});

Outcomes