Trying to help a friend with some code and I can't seem to figure this out, when i am trying to identify something in a webservice the popup box does not appear with a left click, if I right click it does. Has the same issue with a different layers or map services from their server. I watched the traffic in Fiddler and same request is being sent with a right click and a left click. Just no pop-up with a left click. Maybe 1 out of 20 I will get a popup with a left click.
Code works great when I use a map service from my server.
view.when(function()
{
view.on("click", executeIdentifyTask);
identifyTask = new IdentifyTask(parcelURL);
// Set the parameters for the Identify
params = new IdentifyParameters();
params.tolerance = 1;
params.layerIds = [0];
params.layerOption = "visible";
params.returnGeometry = true;
params.width = view.width;
params.height = view.height;
});
// Executes each time the view is clicked
function executeIdentifyTask(event) {
// Set the geometry to the location of the view click
params.geometry = event.mapPoint;
params.mapExtent = view.extent;
document.getElementById("viewDiv").style.cursor = "wait";
identifyTask
.execute(params)
.then(function(response)
{
var results = response.results;
return results.map(function(result)
{
var feature = result.feature;
var layerName = result.layerName;
feature.attributes.layerName = layerName;
feature.popupTemplate = {
// autocasts as new PopupTemplate()
title: "<b>Your property is elligible for sanitation service: Day Week",
content:
"<b>Pickup Day:</b> {DayA_B}"
};
return feature;
});
})
.then(showPopup); // Send the array of features to showPopup()
// Shows the results of the Identify in a popup once the promise is resolved
function showPopup(response)
{
if (response.length > 0)
{
view.popup.dockOptions =
{
buttonEnabled: false,
breakpoint: false,
position: "bottom-right"
};
view.popup.open({
features: response,
location: event.mapPoint,
});
}
document.getElementById("viewDiv").style.cursor = "auto";
}
}