Points with InfoWindow attached to it

2430
6
Jump to solution
05-06-2015 05:37 AM
ThomasSpillard
New Contributor II

Hi,

I created a map with some points on it with the ESRI JavaScript API.

I would now like to attach a InfoWindow (or pop-up, ...) to the point so that when you click on a point, the info window shows with information in it .

I am new to this and haven't found what i wanted so i'm asking here, please tell me if this is inappropriate.

Thanks in advance,

Thomas

0 Kudos
1 Solution

Accepted Solutions
TimWitt2
MVP Regular Contributor

Are those points graphics? If so check out my example here: Button Popup 1 - JSFiddle

Tim

View solution in original post

6 Replies
JaiSiva1
New Contributor III

Hi Thomas,

Assuming that you have used FeatureLayer in your map , i am suggesting the following code :

var map;

      require(["esri/map",

                  "esri/layers/FeatureLayer",

                  "esri/InfoTemplate",

                  "dojo/domReady!"], function(Map,FeatureLayer,InfoTemplate) {

          map = new Map("map", {

          basemap: "topo",  //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd

          center: [0, 0] // longitude, latitude        

        });

  var infoTemplate = new InfoTemplate("${NAME}", "${*}");  // Info template definition

  var featureLayer = new FeatureLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3", {      

          infoTemplate: infoTemplate // assigning the Info template to the feature layer

        });

  map.addLayer(featureLayer);

      });

ThomasSpillard
New Contributor II

In my case i have implemented the map in an other app where I query a table with GlideRecord to create those points, so i it would mean i have to do a Dynamic Layer ? Thanks a lot for your help

0 Kudos
TimWitt2
MVP Regular Contributor

Are those points graphics? If so check out my example here: Button Popup 1 - JSFiddle

Tim

View solution in original post

RickeyFight
MVP Regular Contributor

Thomas,

Here is a link that will help you with info windows/popups  Samples | popups_and_info_windows,

and InfoWindow | API Reference

Tim Witt​'s example is very nice too!

ThomasSpillard
New Contributor II

Hi Rickey,

Indeed I have went through the API References but didn't figure out i had to put the info window and point together in a graphic, Thanks a lot too

Thomas

0 Kudos
ThomasSpillard
New Contributor II

I think this is the best solution for me,

Thanks a lot !

Thomas

0 Kudos