Select to view content in your preferred language

How to add pop up?

1106
3
Jump to solution
10-01-2014 01:03 AM
IonutAlixandroae
Deactivated User

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 !!

0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

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.

View solution in original post

0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor

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.

0 Kudos
IonutAlixandroae
Deactivated User

Thanks !!

0 Kudos
KellyHutchins
Esri Notable Contributor

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.