Issue on Closing InfoTemplate Programmatically in ArcGIS API for JS

3047
3
Jump to solution
09-03-2015 11:18 PM
BruceGreen
New Contributor III

I am trying to hide a layer on the map like

          var point = new esri.geometry.Point(-106.61, 35.1107);
          point = esri.geometry.geographicToWebMercator(point);
          var symbol = new esri.symbol.PictureMarkerSymbol("https://cdn1.iconfinder.com/data/icons/Map-Markers-Icons-Demo-PNG/128/Map-Marker-Marker-Outside-Char...", 32, 32);
          pointInfoTemplate = new InfoTemplate(); 
          pointInfoTemplate.setTitle("Project Details");
          pointInfoTemplate.setContent('<div>Some Att Here</div> ');
          var graphic = new esri.Graphic(point, symbol).setInfoTemplate(pointInfoTemplate);
          layer1 = new esri.layers.GraphicsLayer();
          layer1.add(graphic);
          map.addLayer(layer1);


    $("#hide").on("click", function(){
        layer1.hide();
    });

which works fine but the `InfoTemplate()` remains in the map (in case of it being opened)

mappp.png

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JeremieCornet1
Occasional Contributor II

You can hide the infoWindow with

map.infoWindow.hide()

View solution in original post

3 Replies
JeremieCornet1
Occasional Contributor II

You can hide the infoWindow with

map.infoWindow.hide()

BruceGreen
New Contributor III

Thanks a lot Jeremie, it was very helpful. Can you please also let me know how I can change the highlight box around the marker on click to something like Target sign, as well?

0 Kudos
ChrisSmith7
Frequent Contributor

Behrouz,

This is definitely possible - as a matter of fact, someone had the same question - Change the highlight symbol for a selection

Robert Scheitlin, GISP​ provided some example code on how to do this in that thread.