Hello,
I have a difficult time in adding popups to some points of interest in my application. I have 2 attribute fields that I`m interested in, named : "Type" and "nume" . I want to add popups that when I click them to show me info about those 2 attr fields and also a Zoom To button.
I have tried to apply different samples but I`m a beginner in learning javascript and I couldn`t get a good result.
I have attached the code for help.
Thank you !!
Solved! Go to Solution.
Hi Ionut,
Attached is an update to your code. I added an IdentifyTask following the sample here. I also updated some of the functions so that you cannot identify a feature while you are trying to enter in locations for the Get Directions portion. Once the solve is complete, you should be able to identify the features again.
Hi Ionut,
Attached is an update to your code. I added an IdentifyTask following the sample here. I also updated some of the functions so that you cannot identify a feature while you are trying to enter in locations for the Get Directions portion. Once the solve is complete, you should be able to identify the features again.
Thanks !!
Another option, starting at version 3.10 of the ArcGIS API for JavaScript, would be to define a popup template for a sub layer of the dynamic layer. Here's an example of how this works:
var popupTemplate = new PopupTemplate({title: "{Type}",
fieldInfos: [
{ fieldName: "Type", visible: true},
{ fieldName: "nume", visible: true}]
});
var operationalLayer = new ArcGISDynamicMapServiceLayer("http://eismgeo.dlinkddns.com/eismgeo/rest/services/Aplicatie_NASlope/Aplicatie_NA/MapServer",{"opacity":1});
operationalLayer.setInfoTemplates({
6: {infoTemplate: popupTemplate}
});
// operationalLayer.setVisibleLayers([6]);
map.addLayer(operationalLayer);
The Add two dynamic maps | ArcGIS API for JavaScript sample in the ArcGIS API for JavaScript help provides more detail.